From fdae459948954a5312b24727b0d381ded913797e Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 10 Feb 2013 13:35:58 +0000 Subject: [PATCH] Allow HOME to be undefined, as on Windows. --- src/Main/options.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 365eb4158..8e3e68454 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -1744,10 +1744,12 @@ void Options::init(int argc, char **argv, const SGPath& appDataPath) // then config files SGPath config; - - std::string homedir(getenv("HOME")); + std::string homedir; + if (getenv("HOME")) { + homedir = getenv("HOME"); + } - if( homedir.size() && hostname.size() ) { + if( !homedir.empty() && !hostname.empty() ) { // Check for ~/.fgfsrc.hostname config.set(homedir); config.append(".fgfsrc"); @@ -1757,7 +1759,7 @@ void Options::init(int argc, char **argv, const SGPath& appDataPath) } // Check for ~/.fgfsrc - if( homedir.size() ) { + if( !homedir.empty() ) { config.set(homedir); config.append(".fgfsrc"); readConfig(config); -- 2.39.5