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,24 +407,28 @@ version (OSX) version = useXDG;
|
||||||
*/
|
*/
|
||||||
string getDefaultConfigurationLocation()
|
string getDefaultConfigurationLocation()
|
||||||
{
|
{
|
||||||
|
import std.process : environment;
|
||||||
|
import std.exception : enforce;
|
||||||
version (useXDG)
|
version (useXDG)
|
||||||
{
|
{
|
||||||
import std.process : environment;
|
|
||||||
|
|
||||||
string configDir = environment.get("XDG_CONFIG_HOME", null);
|
string configDir = environment.get("XDG_CONFIG_HOME", null);
|
||||||
if (configDir is null)
|
if (configDir is null)
|
||||||
{
|
{
|
||||||
configDir = environment.get("HOME", null);
|
configDir = environment.get("HOME", null);
|
||||||
if (configDir is null)
|
enforce(configDir !is null, "Both $XDG_CONFIG_HOME and $HOME are unset");
|
||||||
throw new Exception("Both $XDG_CONFIG_HOME and $HOME are unset");
|
|
||||||
configDir = buildPath(configDir, ".config", "dscanner", CONFIG_FILE_NAME);
|
configDir = buildPath(configDir, ".config", "dscanner", CONFIG_FILE_NAME);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
configDir = buildPath(configDir, "dscanner", CONFIG_FILE_NAME);
|
configDir = buildPath(configDir, "dscanner", CONFIG_FILE_NAME);
|
||||||
return configDir;
|
return configDir;
|
||||||
}
|
}
|
||||||
else version (Windows)
|
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