From 20ba8c348fe5e4d3af16fd3775e74d2200a53b98 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 13 Feb 2017 15:08:35 +0300 Subject: Remove ResourceManager::setWriteDir. --- src/client.cpp | 2 +- src/dyetool/client.cpp | 2 +- src/dyetool/dyemain.cpp | 2 +- src/resources/resourcemanager/resourcemanager.cpp | 4 ---- src/resources/resourcemanager/resourcemanager.h | 8 -------- src/utils/virtfs.cpp | 4 ++-- src/utils/virtfs.h | 2 +- 7 files changed, 6 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index 38870b50f..29fdc971a 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -324,7 +324,7 @@ void Client::gameInit() #endif // ANDROID ResourceManager::init(); - if (!resourceManager->setWriteDir(settings.localDataDir)) + if (!VirtFs::setWriteDir(settings.localDataDir)) { logger->error(strprintf("%s couldn't be set as home directory! " "Exiting.", settings.localDataDir.c_str())); diff --git a/src/dyetool/client.cpp b/src/dyetool/client.cpp index d2ace1a36..19ad331a3 100644 --- a/src/dyetool/client.cpp +++ b/src/dyetool/client.cpp @@ -182,7 +182,7 @@ void Client::gameInit() #endif // ANDROID ResourceManager::init(); - if (!resourceManager->setWriteDir(settings.localDataDir)) + if (!VirtFs::setWriteDir(settings.localDataDir)) { logger->error(strprintf("%s couldn't be set as home directory! " "Exiting.", settings.localDataDir.c_str())); diff --git a/src/dyetool/dyemain.cpp b/src/dyetool/dyemain.cpp index 27b159a70..433233143 100644 --- a/src/dyetool/dyemain.cpp +++ b/src/dyetool/dyemain.cpp @@ -87,7 +87,7 @@ int main(int argc, char **argv) #endif // USE_SDL2 ResourceManager::init(); - resourceManager->setWriteDir("."); + VirtFs::setWriteDir("."); VirtFs::addDirToSearchPath(".", Append_false); VirtFs::addDirToSearchPath("/", Append_false); std::string src = argv[1]; diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp index 25fb904d2..530d45902 100644 --- a/src/resources/resourcemanager/resourcemanager.cpp +++ b/src/resources/resourcemanager/resourcemanager.cpp @@ -334,10 +334,6 @@ void ResourceManager::clearDeleted(const bool full) } } } -bool ResourceManager::setWriteDir(const std::string &path) const -{ - return static_cast(VirtFs::setWriteDir(path.c_str())); -} void ResourceManager::searchAndAddArchives(const std::string &restrict path, const std::string &restrict ext, diff --git a/src/resources/resourcemanager/resourcemanager.h b/src/resources/resourcemanager/resourcemanager.h index 6f6875361..b9732947f 100644 --- a/src/resources/resourcemanager/resourcemanager.h +++ b/src/resources/resourcemanager/resourcemanager.h @@ -59,14 +59,6 @@ class ResourceManager final : public MemoryCounter */ ~ResourceManager(); - /** - * Sets the write directory. - * - * @param path The path of the directory to be added. - * @return true on success, false otherwise. - */ - bool setWriteDir(const std::string &path) const; - /** * Searches for zip files and adds them to the search path. */ diff --git a/src/utils/virtfs.cpp b/src/utils/virtfs.cpp index 831ff4e5d..0ab3b668f 100644 --- a/src/utils/virtfs.cpp +++ b/src/utils/virtfs.cpp @@ -130,9 +130,9 @@ namespace VirtFs return file; } - bool setWriteDir(const char *const newDir) + bool setWriteDir(const std::string &newDir) { - return PHYSFS_setWriteDir(newDir); + return PHYSFS_setWriteDir(newDir.c_str()); } bool addDirToSearchPath(const std::string &newDir, diff --git a/src/utils/virtfs.h b/src/utils/virtfs.h index 3bb98c046..f28354790 100644 --- a/src/utils/virtfs.h +++ b/src/utils/virtfs.h @@ -43,7 +43,7 @@ namespace VirtFs VirtFile *openRead(const char *const filename); VirtFile *openWrite(const char *const filename); VirtFile *openAppend(const char *const filename); - bool setWriteDir(const char *const newDir); + bool setWriteDir(const std::string &newDir); bool addDirToSearchPath(const std::string &newDir, const Append append); bool removeDirFromSearchPath(const std::string &oldDir); -- cgit v1.2.3-60-g2f50