]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/options.cxx
Update image-server logic.
[flightgear.git] / src / Main / options.cxx
index 3c20cdee8a8154d97cdeab7822e9feaa46bf50eb..70477ad2c69a156df7fc2c8a2dcc04f145dbaab5 100644 (file)
@@ -1558,9 +1558,7 @@ struct OptionDesc {
     {"atcsim",                       true,  OPTION_CHANNEL, "", false, "dummy", 0 },
     {"atlas",                        true,  OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
     {"httpd",                        true,  OPTION_CHANNEL, "", false, "", 0 },
-#ifdef FG_JPEG_SERVER
     {"jpg-httpd",                    true,  OPTION_CHANNEL, "", false, "", 0 },
-#endif
     {"native",                       true,  OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
     {"native-ctrls",                 true,  OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
     {"native-fdm",                   true,  OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
@@ -2048,7 +2046,7 @@ int Options::parseOption(const string& s)
     
     return addOption(key, value);
   } else {
-    SG_LOG(SG_GENERAL, SG_ALERT, "unknown option:" << s);
+      flightgear::modalMessageBox("Unknown option", "Unknown command-line option: " + s);
     return FG_OPTIONS_ERROR;
   }
 }
@@ -2057,14 +2055,14 @@ int Options::addOption(const string &key, const string &value)
 {
   OptionDesc* desc = p->findOption(key);
   if (!desc) {
-    SG_LOG(SG_GENERAL, SG_ALERT, "unknown option:" << key);
+    flightgear::modalMessageBox("Unknown option", "Unknown command-line option: " + key);
     return FG_OPTIONS_ERROR;
   }
   
   if (!(desc->type & OPTION_MULTI)) {
     OptionValueVec::const_iterator it = p->findValue(key);
     if (it != p->values.end()) {
-      SG_LOG(SG_GENERAL, SG_INFO, "multiple values forbidden for option:" << key << ", ignoring:" << value);
+      SG_LOG(SG_GENERAL, SG_WARN, "multiple values forbidden for option:" << key << ", ignoring:" << value);
       return FG_OPTIONS_OK;
     }
   }
@@ -2106,6 +2104,20 @@ string_list Options::valuesForOption(const std::string& key) const
   return result;
 }
 
+
+static string defaultTerrasyncDir()
+{
+#if defined(SG_WINDOWS)
+       SGPath p(SGPath::documents());
+       p.append("FlightGear");
+#else
+    SGPath p(globals->get_fg_home());
+#endif
+       p.append("TerraSync");
+       return p.str();
+}
+
+
 OptionResult Options::processOptions()
 {
   // establish locale before showing help (this selects the default locale,
@@ -2169,15 +2181,16 @@ OptionResult Options::processOptions()
 // terrasync directory fixup
   string terrasyncDir = fgGetString("/sim/terrasync/scenery-dir");
   if (terrasyncDir.empty()) {
-    SGPath p(globals->get_fg_home());
-    p.append("TerraSync");
-    terrasyncDir = p.str();
-    SG_LOG(SG_GENERAL, SG_INFO,
-           "Using default TerraSync dir: " << terrasyncDir);
-    fgSetString("/sim/terrasync/scenery-dir", terrasyncDir);
+         terrasyncDir = defaultTerrasyncDir();
+         // auto-save it for next time
+         
+         SG_LOG(SG_GENERAL, SG_INFO,
+                 "Using default TerraSync: " << terrasyncDir);
+      fgSetString("/sim/terrasync/scenery-dir", terrasyncDir);
   }
-  
+
   SGPath p(terrasyncDir);
+
   // following is necessary to ensure NavDataCache sees stable scenery paths from
   // terrasync. Ensure the Terrain and Objects subdirs exist immediately, rather
   // than waiting for the first tiles to be scheduled.