"load"/"save" flight: enforce ".sav" extension
This commit is contained in:
parent
76a13e689d
commit
44fdf77601
1 changed files with 6 additions and 2 deletions
|
@ -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 "
|
||||||
|
|
Loading…
Reference in a new issue