diff --git a/platform/platform.cpp b/platform/platform.cpp index d8fd6f1030..74c5401ece 100644 --- a/platform/platform.cpp +++ b/platform/platform.cpp @@ -6,15 +6,12 @@ #include "../base/logging.hpp" -string Platform::ReadPathForFile(string const & file, char const * searchScope) const +string Platform::ReadPathForFile(string const & file, string const & searchScope) const { - ASSERT(searchScope, ()); - - string const strScope(searchScope); string fullPath; - for (size_t i = 0; i < strScope.size(); ++i) + for (size_t i = 0; i < searchScope.size(); ++i) { - switch (strScope[i]) + switch (searchScope[i]) { case 'w': fullPath = m_writableDir + file; break; case 'r': fullPath = m_resourcesDir + file; break; diff --git a/platform/platform.hpp b/platform/platform.hpp index ec7399edc1..6a3572fc21 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -45,7 +45,7 @@ protected: /// Internal function to get full path for input file. /// Uses m_writeableDir and m_resourcesDir. - string ReadPathForFile(string const & file, char const * searchScope) const; + string ReadPathForFile(string const & file, string const & searchScope) const; /// Hash some unique string into uniform format. static string HashUniqueID(string const & s); @@ -79,7 +79,7 @@ public: /// @param[in] file name or full path which we want to read, don't forget to free memory or wrap it to ReaderPtr /// @param[in] searchScope looks for file in dirs in given order: [w]ritable, [r]esources, by [f]ull path /// @TODO add [e]xternal resource scope for Android (obb support) - ModelReader * GetReader(string const & file, char const * searchScope = "wrf") const; + ModelReader * GetReader(string const & file, string const & searchScope = "wrf") const; /// @name File operations //@{ diff --git a/platform/platform_android.cpp b/platform/platform_android.cpp index b038dd5e65..362f0c79e7 100644 --- a/platform/platform_android.cpp +++ b/platform/platform_android.cpp @@ -76,18 +76,17 @@ public: } -ModelReader * Platform::GetReader(string const & file, char const * searchScope) const +ModelReader * Platform::GetReader(string const & file, string const & searchScope) const { // @TODO now we handle only two specific cases needed to release guides ads - string const strScope(searchScope); - if (strScope == "w") + if (searchScope == "w") { string const path = m_writableDir + file; if (IsFileExistsByFullPath(path)) return new FileReader(path, READER_CHUNK_LOG_SIZE, READER_CHUNK_LOG_COUNT); MYTHROW(FileAbsentException, ("File not found", file)); } - else if (strScope == "r") + else if (searchScope == "r") { return new ZipFileReader(m_resourcesDir, "assets/" + file); } diff --git a/platform/platform_ios.mm b/platform/platform_ios.mm index 696e05653f..3f20526c6c 100644 --- a/platform/platform_ios.mm +++ b/platform/platform_ios.mm @@ -72,7 +72,7 @@ bool Platform::GetFileSizeByName(string const & fileName, uint64_t & size) const } } -ModelReader * Platform::GetReader(string const & file, char const * searchScope) const +ModelReader * Platform::GetReader(string const & file, string const & searchScope) const { return new FileReader(ReadPathForFile(file, searchScope), READER_CHUNK_LOG_SIZE, READER_CHUNK_LOG_COUNT); diff --git a/platform/platform_qt.cpp b/platform/platform_qt.cpp index e01b725cf8..d15fa664e3 100644 --- a/platform/platform_qt.cpp +++ b/platform/platform_qt.cpp @@ -12,7 +12,7 @@ #include -ModelReader * Platform::GetReader(string const & file, char const * searchScope) const +ModelReader * Platform::GetReader(string const & file, string const & searchScope) const { return new FileReader(ReadPathForFile(file, searchScope), READER_CHUNK_LOG_SIZE, READER_CHUNK_LOG_COUNT);