Fix local saves with "." having their name cut off, add a warning for a few invalid file names
This commit is contained in:
parent
16d686e949
commit
646935edb3
@ -69,7 +69,7 @@ class LoadFilesTask: public Task
|
||||
saveFiles.push_back(saveFile);
|
||||
|
||||
ByteString filename = (*iter).SplitFromEndBy(PATH_SEP).After();
|
||||
filename = filename.SplitBy('.').Before();
|
||||
filename = filename.SplitFromEndBy('.').Before();
|
||||
saveFile->SetDisplayName(filename.FromUtf8());
|
||||
}
|
||||
catch(std::exception & e)
|
||||
|
@ -90,7 +90,11 @@ void LocalSaveActivity::Save()
|
||||
virtual ~FileOverwriteConfirmation() { }
|
||||
};
|
||||
|
||||
if(filenameField->GetText().length())
|
||||
if (filenameField->GetText().Contains('/') || filenameField->GetText().BeginsWith("."))
|
||||
{
|
||||
new ErrorMessage("Error", "Invalid filename.");
|
||||
}
|
||||
else if (filenameField->GetText().length())
|
||||
{
|
||||
ByteString finalFilename = ByteString(LOCAL_SAVE_DIR) + ByteString(PATH_SEP) + filenameField->GetText().ToUtf8() + ".cps";
|
||||
save.SetDisplayName(filenameField->GetText());
|
||||
|
Loading…
Reference in New Issue
Block a user