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

bluegr bluegr at gmail.com
Mon Aug 12 09:39:48 CEST 2019


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

Summary:
7311252d8a POSIX: Remove POSIX-specific checkPath function
ba2bc60043 BACKENDS: Use the default save file manager on Switch and SamsungTV


Commit: 7311252d8abbb736abcf1d01019d9ad572c95e2c
    https://github.com/scummvm/scummvm/commit/7311252d8abbb736abcf1d01019d9ad572c95e2c
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-08-12T10:39:43+03:00

Commit Message:
POSIX: Remove POSIX-specific checkPath function

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


diff --git a/backends/saves/posix/posix-saves.cpp b/backends/saves/posix/posix-saves.cpp
index 35f9fa2..045ccb0 100644
--- a/backends/saves/posix/posix-saves.cpp
+++ b/backends/saves/posix/posix-saves.cpp
@@ -38,9 +38,6 @@
 #include "common/savefile.h"
 #include "common/textconsole.h"
 
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
 #include <sys/stat.h>
 
 POSIXSaveFileManager::POSIXSaveFileManager() {
@@ -133,69 +130,4 @@ POSIXSaveFileManager::POSIXSaveFileManager() {
 #endif
 }
 
-void POSIXSaveFileManager::checkPath(const Common::FSNode &dir) {
-	const Common::String path = dir.getPath();
-	clearError();
-
-	struct stat sb;
-
-	// Check whether the dir exists
-	if (stat(path.c_str(), &sb) == -1) {
-		// The dir does not exist, or stat failed for some other reason.
-		// If the problem was that the path pointed to nothing, try
-		// to create the dir (ENOENT case).
-		switch (errno) {
-		case EACCES:
-			setError(Common::kWritePermissionDenied, "Search or write permission denied: "+path);
-			break;
-		case ELOOP:
-			setError(Common::kUnknownError, "Too many symbolic links encountered while traversing the path: "+path);
-			break;
-		case ENAMETOOLONG:
-			setError(Common::kUnknownError, "The path name is too long: "+path);
-			break;
-		case ENOENT:
-			if (mkdir(path.c_str(), 0755) != 0) {
-				// mkdir could fail for various reasons: The parent dir doesn't exist,
-				// or is not writeable, the path could be completly bogus, etc.
-				warning("mkdir for '%s' failed", path.c_str());
-				perror("mkdir");
-
-				switch (errno) {
-				case EACCES:
-					setError(Common::kWritePermissionDenied, "Search or write permission denied: "+path);
-					break;
-				case EMLINK:
-					setError(Common::kUnknownError, "The link count of the parent directory would exceed {LINK_MAX}: "+path);
-					break;
-				case ELOOP:
-					setError(Common::kUnknownError, "Too many symbolic links encountered while traversing the path: "+path);
-					break;
-				case ENAMETOOLONG:
-					setError(Common::kUnknownError, "The path name is too long: "+path);
-					break;
-				case ENOENT:
-					setError(Common::kPathDoesNotExist, "A component of the path does not exist, or the path is an empty string: "+path);
-					break;
-				case ENOTDIR:
-					setError(Common::kPathDoesNotExist, "A component of the path prefix is not a directory: "+path);
-					break;
-				case EROFS:
-					setError(Common::kWritePermissionDenied, "The parent directory resides on a read-only file system:"+path);
-					break;
-				}
-			}
-			break;
-		case ENOTDIR:
-			setError(Common::kPathDoesNotExist, "A component of the path prefix is not a directory: "+path);
-			break;
-		}
-	} else {
-		// So stat() succeeded. But is the path actually pointing to a directory?
-		if (!S_ISDIR(sb.st_mode)) {
-			setError(Common::kPathDoesNotExist, "The given savepath is not a directory: "+path);
-		}
-	}
-}
-
 #endif
diff --git a/backends/saves/posix/posix-saves.h b/backends/saves/posix/posix-saves.h
index 2477bd6..2257b75 100644
--- a/backends/saves/posix/posix-saves.h
+++ b/backends/saves/posix/posix-saves.h
@@ -35,14 +35,6 @@
 class POSIXSaveFileManager : public DefaultSaveFileManager {
 public:
 	POSIXSaveFileManager();
-
-protected:
-	/**
-	 * Checks the given path for read access, existence, etc.
-	 * In addition, tries to create a missing savedir, if possible.
-	 * Sets the internal error and error message accordingly.
-	 */
-	virtual void checkPath(const Common::FSNode &dir);
 };
 #endif
 


Commit: ba2bc60043c8a1bbc651ca237783ef5e6883bda0
    https://github.com/scummvm/scummvm/commit/ba2bc60043c8a1bbc651ca237783ef5e6883bda0
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-08-12T10:39:43+03:00

Commit Message:
BACKENDS: Use the default save file manager on Switch and SamsungTV

Changed paths:
    backends/platform/samsungtv/samsungtv.cpp
    backends/platform/sdl/switch/switch.cpp
    backends/saves/posix/posix-saves.cpp


diff --git a/backends/platform/samsungtv/samsungtv.cpp b/backends/platform/samsungtv/samsungtv.cpp
index e72b1ee..54c2d5f 100644
--- a/backends/platform/samsungtv/samsungtv.cpp
+++ b/backends/platform/samsungtv/samsungtv.cpp
@@ -35,6 +35,11 @@ OSystem_SDL_SamsungTV::OSystem_SDL_SamsungTV()
 }
 
 void OSystem_SDL_SamsungTV::initBackend() {
+	// Create the savefile manager
+	if (_savefileManager == 0) {
+		_savefileManager = new DefaultSaveFileManager("/mtd_wiselink/scummvm savegames");
+	}
+
 	// Create the events manager
 	if (_eventSource == 0)
 		_eventSource = new SamsungTVSdlEventSource();
diff --git a/backends/platform/sdl/switch/switch.cpp b/backends/platform/sdl/switch/switch.cpp
index 85e7b7a..ab8427c 100644
--- a/backends/platform/sdl/switch/switch.cpp
+++ b/backends/platform/sdl/switch/switch.cpp
@@ -77,7 +77,7 @@ void OSystem_Switch::initBackend() {
 
 	// Create the savefile manager
 	if (_savefileManager == 0) {
-		_savefileManager = new POSIXSaveFileManager();
+		_savefileManager = new DefaultSaveFileManager("./saves");
 	}
 
 	// Event source
diff --git a/backends/saves/posix/posix-saves.cpp b/backends/saves/posix/posix-saves.cpp
index 045ccb0..0863e44 100644
--- a/backends/saves/posix/posix-saves.cpp
+++ b/backends/saves/posix/posix-saves.cpp
@@ -42,12 +42,6 @@
 
 POSIXSaveFileManager::POSIXSaveFileManager() {
 	// Register default savepath.
-#if defined(SAMSUNGTV)
-	ConfMan.registerDefault("savepath", "/mtd_wiselink/scummvm savegames");
-#elif defined(NINTENDO_SWITCH)
-	Posix::assureDirectoryExists("./saves", nullptr);
-	ConfMan.registerDefault("savepath", "./saves");
-#else
 	Common::String savePath;
 
 #if defined(MACOSX)
@@ -127,7 +121,6 @@ POSIXSaveFileManager::POSIXSaveFileManager() {
 			}
 		}
 	}
-#endif
 }
 
 #endif





More information about the Scummvm-git-logs mailing list