Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Failed to locate the configuration file on Windows #195

Closed
luxtau opened this Issue · 4 comments

3 participants

@luxtau

Under Windows, LDC installed to $LDC_INSTALL_PREFIX/bin, but config file placed to $LDC_INSTALL_PREFIX/etc.

But ConfigFile::locate doesn't look at "/etc" directory.

Patch:


diff --git a/driver/configfile.cpp b/driver/configfile.cpp
index 5adc265..3cec6b8 100644
--- a/driver/configfile.cpp
+++ b/driver/configfile.cpp
@@ -67,6 +67,13 @@ bool ConfigFile::locate(sys::Path& p, const char* argv0, void* mainAddr, const c
     p.appendComponent(filename);
     if (sys::fs::exists(p.str()))
         return true;
+
+    // try the install-prefix/etc
+    p = sys::Path(LDC_INSTALL_PREFIX);
+    p.appendComponent("etc");
+    p.appendComponent(filename);
+    if (sys::fs::exists(p.str()))
+        return true;
 #else
     // try the install-prefix/etc
     p = sys::Path(LDC_INSTALL_PREFIX);
@klickverbot
Owner

I don't think using LDC_INSTALL_PREFIX on Windows (and in general as well, even if the problem is not as big there) is a good idea, since it breaks on moving the program directory. And I do this quite often, at least as long as the piece of software doesn't come with an installer. Maybe we can just try ${executable location}/../etc/?

@luxtau

As you wish, the main goal is to read config under windows correctly :)

@klickverbot
Owner

@luxtau: As I don't have LLVM installed in my Windows VM right now, would you mind testing if that method works for you? For how to determine the exe location, see some of the first paths tried.

@luxtau

I tested my solution, it works. If you want to use "exe/../etc", it is not a problem, i will make another patch and test it.

@redstar redstar was assigned
@redstar redstar closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.