Skip to content

Commit

Permalink
Posix: use /etc/dub/settings.json if in /usr
Browse files Browse the repository at this point in the history
Fix #1472

/etc/dub/settings.json overrides /usr/etc/dub/settings.json (as
suggested by the `man hier` manpage)
  • Loading branch information
WebFreak001 committed Dec 7, 2021
1 parent d50507d commit 59bfd3f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion source/dub/dub.d
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,15 @@ class Dub {
m_dirs.temp = NativePath(tempDir);

m_config = new DubConfig(jsonFromFile(m_dirs.systemSettings ~ "settings.json", true), m_config);
m_config = new DubConfig(jsonFromFile(NativePath(thisExePath).parentPath ~ "../etc/dub/settings.json", true), m_config);

auto dubFolderPath = NativePath(thisExePath).parentPath;
m_config = new DubConfig(jsonFromFile(dubFolderPath ~ "../etc/dub/settings.json", true), m_config);
version (Posix) {
if (!dubFolderPath.empty && dubFolderPath.nodes[0].name == "usr") {
m_config = new DubConfig(jsonFromFile(NativePath("/etc/dub/settings.json"), true), m_config);
}
}

m_config = new DubConfig(jsonFromFile(m_dirs.userSettings ~ "settings.json", true), m_config);

if (!root_path.empty)
Expand Down

0 comments on commit 59bfd3f

Please sign in to comment.