]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_init.cxx
Reset: make fgSetDefaults non-static.
[flightgear.git] / src / Main / fg_init.cxx
index f478098b5dbc73b4239547645b8f296493252abe..d1d4d15ca8237368e373b5e37941ea20f2c529be 100644 (file)
 #  include <process.h>          // _getpid()
 #  include <Windows.h>
 #  define isatty _isatty
+#else
+// for open() and options
+#  include <sys/types.h>        
+#  include <sys/stat.h>
+#  include <fcntl.h>
 #endif
 
 #include <string>
 #include "positioninit.hxx"
 #include "util.hxx"
 
+#if defined(SG_MAC)
+#include <GUI/CocoaHelpers.h> // for Mac impl of platformDefaultDataPath()
+#endif
+
 using std::string;
 using std::endl;
 using std::cerr;
@@ -381,27 +390,10 @@ static SGPath platformDefaultDataPath()
   return config;
 }
 
-#elif __APPLE__
-#include <CoreServices/CoreServices.h>
+#elif defined(SG_MAC)
 
-static SGPath platformDefaultDataPath()
-{
-  FSRef ref;
-  OSErr err = FSFindFolder(kUserDomain, kApplicationSupportFolderType, false, &ref);
-  if (err) {
-    return SGPath();
-  }
-
-  unsigned char path[1024];
-  if (FSRefMakePath(&ref, path, 1024) != noErr) {
-    return SGPath();
-  }
+// platformDefaultDataPath defined in GUI/CocoaHelpers.h
 
-  SGPath appData;
-  appData.set((const char*) path);
-  appData.append("FlightGear");
-  return appData;
-}
 #else
 static SGPath platformDefaultDataPath()
 {
@@ -498,6 +490,7 @@ int fgInitConfig ( int argc, char **argv )
     home->setStringValue(dataPath.c_str());
     home->setAttribute(SGPropertyNode::WRITE, false);
   
+    fgSetDefaults();
     flightgear::Options* options = flightgear::Options::sharedInstance();
     options->init(argc, argv, dataPath);
     bool loadDefaults = flightgear::Options::sharedInstance()->shouldLoadDefaultConfig();