Allow HOME to be undefined, as on Windows.
This commit is contained in:
parent
67ca0689c9
commit
fdae459948
1 changed files with 6 additions and 4 deletions
|
@ -1744,10 +1744,12 @@ void Options::init(int argc, char **argv, const SGPath& appDataPath)
|
||||||
|
|
||||||
// then config files
|
// then config files
|
||||||
SGPath config;
|
SGPath config;
|
||||||
|
std::string homedir;
|
||||||
std::string homedir(getenv("HOME"));
|
if (getenv("HOME")) {
|
||||||
|
homedir = getenv("HOME");
|
||||||
|
}
|
||||||
|
|
||||||
if( homedir.size() && hostname.size() ) {
|
if( !homedir.empty() && !hostname.empty() ) {
|
||||||
// Check for ~/.fgfsrc.hostname
|
// Check for ~/.fgfsrc.hostname
|
||||||
config.set(homedir);
|
config.set(homedir);
|
||||||
config.append(".fgfsrc");
|
config.append(".fgfsrc");
|
||||||
|
@ -1757,7 +1759,7 @@ void Options::init(int argc, char **argv, const SGPath& appDataPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for ~/.fgfsrc
|
// Check for ~/.fgfsrc
|
||||||
if( homedir.size() ) {
|
if( !homedir.empty() ) {
|
||||||
config.set(homedir);
|
config.set(homedir);
|
||||||
config.append(".fgfsrc");
|
config.append(".fgfsrc");
|
||||||
readConfig(config);
|
readConfig(config);
|
||||||
|
|
Loading…
Add table
Reference in a new issue