aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2016-08-26 11:20:11 +0300
committerGitHub2016-08-26 11:20:11 +0300
commit25b8f196cb89c60011667491734eb13874d9c9fb (patch)
treee199baf6a3856c781a5af5b1187f7ae56cf56f89
parentfde400c33267fcb7b48ba1508e6191008a1de4de (diff)
parent5734400a373cc696c52c3437400d32a5f1af4699 (diff)
downloadscummvm-rg350-25b8f196cb89c60011667491734eb13874d9c9fb.tar.gz
scummvm-rg350-25b8f196cb89c60011667491734eb13874d9c9fb.tar.bz2
scummvm-rg350-25b8f196cb89c60011667491734eb13874d9c9fb.zip
Merge pull request #815 from wjp/sci-fileiorename
SCI: Make kFileIORename use wrapped filenames
-rw-r--r--engines/sci/engine/kfile.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index e5b0aaf47a..e8b9d0461d 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -632,6 +632,15 @@ reg_t kFileIORename(EngineState *s, int argc, reg_t *argv) {
Common::String oldName = s->_segMan->getString(argv[0]);
Common::String newName = s->_segMan->getString(argv[1]);
+ // We don't fully implement all cases that could occur here, and
+ // assume the file to be renamed is a wrapped filename.
+ // Known usage: In Phant1 and KQ7 while deleting savegames.
+ // The scripts rewrite the dir file as a temporary file, and then
+ // rename it to the actual dir file.
+
+ oldName = g_sci->wrapFilename(oldName);
+ newName = g_sci->wrapFilename(newName);
+
// SCI1.1 returns 0 on success and a DOS error code on fail. SCI32
// returns -1 on fail. We just return -1 for all versions.
if (g_sci->getSaveFileManager()->renameSavefile(oldName, newName))