[Scummvm-git-logs] scummvm master -> a69da418f5d9d0f7f5709cd5385050e2370d3af0

dreammaster dreammaster at scummvm.org
Tue Apr 13 03:18:09 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a69da418f5 AGS: Open up the file creation to all file types


Commit: a69da418f5d9d0f7f5709cd5385050e2370d3af0
    https://github.com/scummvm/scummvm/commit/a69da418f5d9d0f7f5709cd5385050e2370d3af0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-04-12T20:17:59-07:00

Commit Message:
AGS: Open up the file creation to all file types

This fixes startup errors in Relic of the Viking

Changed paths:
    engines/ags/shared/util/filestream.cpp


diff --git a/engines/ags/shared/util/filestream.cpp b/engines/ags/shared/util/filestream.cpp
index e4353273c1..c55fc11dd5 100644
--- a/engines/ags/shared/util/filestream.cpp
+++ b/engines/ags/shared/util/filestream.cpp
@@ -194,22 +194,24 @@ void FileStream::Open(const String &file_name, FileOpenMode open_mode, FileWorkM
 		if (!file_name.CompareLeftNoCase(SAVE_FOLDER_PREFIX)) {
 			_outSave = g_system->getSavefileManager()->openForSaving(
 				file_name + strlen(SAVE_FOLDER_PREFIX), false);
-		} else if (!file_name.CompareRightNoCase(".log")) {
+		} else {
 			Common::String fname = file_name;
 			if (fname.hasPrefix("./"))
 				fname = fname.substr(2);
 			else if (fname.hasPrefix("/"))
 				fname.deleteChar(0);
+			else if (fname.findFirstOf('/') != Common::String::npos)
+				error("Invalid attempt to create file - %s", fname.c_str());
 
 			_outSave = g_system->getSavefileManager()->openForSaving(fname, false);
-		} else {
-			error("Creating files is only supported for savegames");
 		}
 
-		if (_outSave)
-			// Any data written has to first go through the memory stream buffer,
-			// since the savegame code uses Seeks, which OutSaveFile doesn't support
-			_file = &_writeBuffer;
+		if (!_outSave)
+			error("Invalid attempt to create file - %s", file_name.GetCStr());
+
+		// Any data written has to first go through the memory stream buffer,
+		// since the savegame code uses Seeks, which OutSaveFile doesn't support
+		_file = &_writeBuffer;
 	}
 }
 




More information about the Scummvm-git-logs mailing list