]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_commands.cxx
Make sure 'make dist' keeps working.
[flightgear.git] / src / Main / fg_commands.cxx
index b4b07ddcea9963b238e728c2e0423efe8b449f90..9b0fd0f40a5535795d250ae0a35d78a3d492ce15 100644 (file)
@@ -8,8 +8,8 @@
 
 #include <simgear/compiler.h>
 
-#include STL_STRING
-#include STL_FSTREAM
+#include <string>
+#include <fstream>
 
 #include <simgear/sg_inlines.h>
 #include <simgear/debug/logstream.hxx>
@@ -18,6 +18,7 @@
 #include <simgear/structure/exception.hxx>
 #include <simgear/structure/commands.hxx>
 #include <simgear/props/props.hxx>
+#include <simgear/structure/event_mgr.hxx>
 
 #include <Cockpit/panel.hxx>
 #include <Cockpit/panel_io.hxx>
@@ -45,9 +46,9 @@
 #include "viewmgr.hxx"
 #include "main.hxx"
 
-SG_USING_STD(string);
-SG_USING_STD(ifstream);
-SG_USING_STD(ofstream);
+using std::string;
+using std::ifstream;
+using std::ofstream;
 
 
 \f
@@ -320,7 +321,9 @@ do_resume (const SGPropertyNode * arg)
 static bool
 do_load (const SGPropertyNode * arg)
 {
-    const string &file = arg->getStringValue("file", "fgfs.sav");
+    string file = arg->getStringValue("file", "fgfs.sav");
+    if (file.size() < 4 || file.substr(file.size() - 4) != ".sav")
+        file += ".sav";
 
     if (!fgValidatePath(file.c_str(), false)) {
         SG_LOG(SG_IO, SG_ALERT, "load: reading '" << file << "' denied "
@@ -349,7 +352,9 @@ do_load (const SGPropertyNode * arg)
 static bool
 do_save (const SGPropertyNode * arg)
 {
-    const string &file = arg->getStringValue("file", "fgfs.sav");
+    string file = arg->getStringValue("file", "fgfs.sav");
+    if (file.size() < 4 || file.substr(file.size() - 4) != ".sav")
+        file += ".sav";
 
     if (!fgValidatePath(file.c_str(), false)) {
         SG_LOG(SG_IO, SG_ALERT, "save: reading '" << file << "' denied "