mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 01:38:36 +00:00
DIRECTOR: Fix FileIO::m_displaySave
This commit is contained in:
parent
f44988d423
commit
707a854668
@ -226,7 +226,7 @@ FileIOError FileObject::open(const Common::String &origpath, const Common::Strin
|
||||
|
||||
if (option.hasPrefix("?")) {
|
||||
option = option.substr(1);
|
||||
path = getFileNameFromModal(option.equalsIgnoreCase("write"), origpath, "txt");
|
||||
path = getFileNameFromModal(option.equalsIgnoreCase("write"), origpath, Common::String(), "txt");
|
||||
if (path.empty()) {
|
||||
return kErrorFileNotFound;
|
||||
}
|
||||
@ -376,11 +376,13 @@ void FileIO::m_closeFile(int nargs) {
|
||||
XOBJSTUB(FileIO::m_createFile, 0)
|
||||
|
||||
void FileIO::m_displayOpen(int nargs) {
|
||||
g_lingo->push(getFileNameFromModal(false, Common::String(), "txt"));
|
||||
g_lingo->push(getFileNameFromModal(false, Common::String(), Common::String(), "txt"));
|
||||
}
|
||||
|
||||
void FileIO::m_displaySave(int nargs) {
|
||||
g_lingo->push(getFileNameFromModal(true, Common::String(), "txt"));
|
||||
Datum defaultFileName = g_lingo->pop();
|
||||
Datum title = g_lingo->pop();
|
||||
g_lingo->push(getFileNameFromModal(true, Common::String(), title.asString(), "txt"));
|
||||
}
|
||||
|
||||
XOBJSTUB(FileIO::m_setFilterMask, 0)
|
||||
|
@ -585,7 +585,7 @@ void MMovieXObj::m_readFile(int nargs) {
|
||||
Common::String prefix = savePrefix();
|
||||
Common::String result;
|
||||
if (origPath.empty()) {
|
||||
path = getFileNameFromModal(false, Common::String(), "txt");
|
||||
path = getFileNameFromModal(false, Common::String(), Common::String(), "txt");
|
||||
if (path.empty()) {
|
||||
debugC(5, kDebugXObj, "MMovieXObj::m_readFile(): read cancelled by modal");
|
||||
g_lingo->push(result);
|
||||
@ -646,7 +646,7 @@ void MMovieXObj::m_writeFile(int nargs) {
|
||||
|
||||
Common::String prefix = savePrefix();
|
||||
if (origPath.empty()) {
|
||||
path = getFileNameFromModal(true, Common::String(), "txt");
|
||||
path = getFileNameFromModal(true, Common::String(), Common::String(), "txt");
|
||||
if (path.empty()) {
|
||||
debugC(5, kDebugXObj, "MMovieXObj::m_writeFile(): read cancelled by modal");
|
||||
g_lingo->push(result);
|
||||
|
@ -974,14 +974,14 @@ Common::Path findAudioPath(const Common::String &path, bool currentFolder, bool
|
||||
return result;
|
||||
}
|
||||
|
||||
Common::String getFileNameFromModal(bool save, const Common::String &suggested, const char *ext) {
|
||||
Common::String getFileNameFromModal(bool save, const Common::String &suggested, const Common::String &title, const char *ext) {
|
||||
Common::String prefix = savePrefix();
|
||||
Common::String mask = prefix + "*";
|
||||
if (ext) {
|
||||
mask += ".";
|
||||
mask += ext;
|
||||
}
|
||||
GUI::FileBrowserDialog browser(nullptr, "txt", save ? GUI::kFBModeSave : GUI::kFBModeLoad, mask.c_str(), suggested.c_str());
|
||||
GUI::FileBrowserDialog browser(title.c_str(), "txt", save ? GUI::kFBModeSave : GUI::kFBModeLoad, mask.c_str(), suggested.c_str());
|
||||
if (browser.runModal() <= 0) {
|
||||
return Common::String();
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ Common::Path findMoviePath(const Common::String &path, bool currentFolder = true
|
||||
Common::Path findXLibPath(const Common::String &path, bool currentFolder = true, bool searchPaths = true);
|
||||
Common::Path findAudioPath(const Common::String &path, bool currentFolder = true, bool searchPaths = true);
|
||||
|
||||
Common::String getFileNameFromModal(bool save, const Common::String &suggested, const char *ext = "txt");
|
||||
Common::String getFileNameFromModal(bool save, const Common::String &suggested, const Common::String &title, const char *ext = "txt");
|
||||
Common::String savePrefix();
|
||||
|
||||
bool hasExtension(Common::String filename);
|
||||
|
Loading…
x
Reference in New Issue
Block a user