[Scummvm-git-logs] scummvm master -> 9eab979bfb6d4abeb3b38d97f67ebf8d576e6237

sluicebox noreply at scummvm.org
Tue Oct 15 05:04:27 UTC 2024


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:
9eab979bfb WIN32: Make deleting save files UNICODE compatible


Commit: 9eab979bfb6d4abeb3b38d97f67ebf8d576e6237
    https://github.com/scummvm/scummvm/commit/9eab979bfb6d4abeb3b38d97f67ebf8d576e6237
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-10-14T23:03:37-06:00

Commit Message:
WIN32: Make deleting save files UNICODE compatible

Changed paths:
    backends/saves/windows/windows-saves.cpp
    backends/saves/windows/windows-saves.h


diff --git a/backends/saves/windows/windows-saves.cpp b/backends/saves/windows/windows-saves.cpp
index 7f35c2853f0..9a99c98ffe6 100644
--- a/backends/saves/windows/windows-saves.cpp
+++ b/backends/saves/windows/windows-saves.cpp
@@ -54,4 +54,17 @@ WindowsSaveFileManager::WindowsSaveFileManager(bool isPortable) {
 	ConfMan.registerDefault("savepath", Common::Path(Win32::tcharToString(defaultSavepath), Common::Path::kNativeSeparator));
 }
 
+Common::ErrorCode WindowsSaveFileManager::removeFile(const Common::FSNode &fileNode) {
+	TCHAR *tFile = Win32::stringToTchar(fileNode.getPath().toString(Common::Path::kNativeSeparator));
+	int result = _tremove(tFile);
+	free(tFile);
+	if (result == 0)
+		return Common::kNoError;
+	if (errno == EACCES)
+		return Common::kWritePermissionDenied;
+	if (errno == ENOENT)
+		return Common::kPathDoesNotExist;
+	return Common::kUnknownError;
+}
+
 #endif
diff --git a/backends/saves/windows/windows-saves.h b/backends/saves/windows/windows-saves.h
index 4b2fc5fec8c..e35213b1822 100644
--- a/backends/saves/windows/windows-saves.h
+++ b/backends/saves/windows/windows-saves.h
@@ -30,6 +30,9 @@
 class WindowsSaveFileManager final : public DefaultSaveFileManager {
 public:
 	WindowsSaveFileManager(bool isPortable);
+
+protected:
+	Common::ErrorCode removeFile(const Common::FSNode &fileNode) override;
 };
 
 #endif




More information about the Scummvm-git-logs mailing list