aboutsummaryrefslogtreecommitdiff
path: root/backends/saves
diff options
context:
space:
mode:
authorCameron Cawley2019-08-11 20:40:42 +0100
committerFilippos Karapetis2019-08-12 10:39:43 +0300
commit7311252d8abbb736abcf1d01019d9ad572c95e2c (patch)
tree7d7851f2882cd8f9a1c0f48fa15ca5d4a2637553 /backends/saves
parent0069281c0901d194035c937d221a1386d1fe8386 (diff)
downloadscummvm-rg350-7311252d8abbb736abcf1d01019d9ad572c95e2c.tar.gz
scummvm-rg350-7311252d8abbb736abcf1d01019d9ad572c95e2c.tar.bz2
scummvm-rg350-7311252d8abbb736abcf1d01019d9ad572c95e2c.zip
POSIX: Remove POSIX-specific checkPath function
Diffstat (limited to 'backends/saves')
-rw-r--r--backends/saves/posix/posix-saves.cpp68
-rw-r--r--backends/saves/posix/posix-saves.h8
2 files changed, 0 insertions, 76 deletions
diff --git a/backends/saves/posix/posix-saves.cpp b/backends/saves/posix/posix-saves.cpp
index 35f9fa2050..045ccb08ba 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 2477bd60e7..2257b75b0d 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