1
0
Fork 0

"load"/"save" flight: enforce ".sav" extension

This commit is contained in:
mfranz 2008-07-11 20:55:43 +00:00
parent 76a13e689d
commit 44fdf77601

View file

@ -320,7 +320,9 @@ do_resume (const SGPropertyNode * arg)
static bool static bool
do_load (const SGPropertyNode * arg) 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)) { if (!fgValidatePath(file.c_str(), false)) {
SG_LOG(SG_IO, SG_ALERT, "load: reading '" << file << "' denied " SG_LOG(SG_IO, SG_ALERT, "load: reading '" << file << "' denied "
@ -349,7 +351,9 @@ do_load (const SGPropertyNode * arg)
static bool static bool
do_save (const SGPropertyNode * arg) 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)) { if (!fgValidatePath(file.c_str(), false)) {
SG_LOG(SG_IO, SG_ALERT, "save: reading '" << file << "' denied " SG_LOG(SG_IO, SG_ALERT, "save: reading '" << file << "' denied "