Failed to locate the configuration file on Windows #195

Closed
luxtau opened this Issue Oct 12, 2012 · 4 comments

Comments

Projects
None yet
3 participants
@luxtau

luxtau commented Oct 12, 2012

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

This comment has been minimized.

Show comment Hide comment
@klickverbot

klickverbot Oct 12, 2012

Member

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/?

Member

klickverbot commented Oct 12, 2012

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

This comment has been minimized.

Show comment Hide comment
@luxtau

luxtau Oct 12, 2012

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

luxtau commented Oct 12, 2012

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

@klickverbot

This comment has been minimized.

Show comment Hide comment
@klickverbot

klickverbot Oct 12, 2012

Member

@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.

Member

klickverbot commented Oct 12, 2012

@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

This comment has been minimized.

Show comment Hide comment
@luxtau

luxtau Oct 12, 2012

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.

luxtau commented Oct 12, 2012

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.

@ghost ghost assigned redstar Oct 13, 2012

@redstar redstar closed this Oct 13, 2012

redstar pushed a commit that referenced this issue Sep 27, 2014

Merge pull request #195 from alexrp/call-with-stack-shell
Expose a thread_callWithStackShell() function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment