From: mfranz Date: Fri, 11 Jul 2008 20:55:43 +0000 (+0000) Subject: "load"/"save" flight: enforce ".sav" extension X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=44fdf77601270749ad4029a6431343da1e513cf2;p=flightgear.git "load"/"save" flight: enforce ".sav" extension --- diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index b4b07ddce..50e46ad9a 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -320,7 +320,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 +351,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 "