mirror of
https://github.com/dlang-community/D-Scanner.git
synced 2025-04-26 21:30:14 +03:00
Fix #268 - Use the User's profile directory under Windows
This commit is contained in:
parent
845f363d79
commit
75274faedb
1 changed files with 10 additions and 6 deletions
|
@ -407,16 +407,15 @@ version (OSX) version = useXDG;
|
|||
*/
|
||||
string getDefaultConfigurationLocation()
|
||||
{
|
||||
import std.process : environment;
|
||||
import std.exception : enforce;
|
||||
version (useXDG)
|
||||
{
|
||||
import std.process : environment;
|
||||
|
||||
string configDir = environment.get("XDG_CONFIG_HOME", null);
|
||||
if (configDir is null)
|
||||
{
|
||||
configDir = environment.get("HOME", null);
|
||||
if (configDir is null)
|
||||
throw new Exception("Both $XDG_CONFIG_HOME and $HOME are unset");
|
||||
enforce(configDir !is null, "Both $XDG_CONFIG_HOME and $HOME are unset");
|
||||
configDir = buildPath(configDir, ".config", "dscanner", CONFIG_FILE_NAME);
|
||||
}
|
||||
else
|
||||
|
@ -424,7 +423,12 @@ string getDefaultConfigurationLocation()
|
|||
return configDir;
|
||||
}
|
||||
else version(Windows)
|
||||
return CONFIG_FILE_NAME;
|
||||
{
|
||||
string configDir = environment.get("APPDATA", null);
|
||||
enforce(configDir !is null, "%APPDATA% is unset");
|
||||
configDir = buildPath(configDir, "dscanner", CONFIG_FILE_NAME);
|
||||
return configDir;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue