]> git.mxchange.org Git - flightgear.git/commitdiff
Allow HOME to be undefined, as on Windows.
authorJames Turner <zakalawe@mac.com>
Sun, 10 Feb 2013 13:35:58 +0000 (13:35 +0000)
committerJames Turner <zakalawe@mac.com>
Sun, 10 Feb 2013 13:35:58 +0000 (13:35 +0000)
src/Main/options.cxx

index 365eb415893cc67e8879e7e09d308a88d5ea5fbe..8e3e6845491001a1f7cd9beef3a4bdcb24109079 100644 (file)
@@ -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);