diff options
author | vng <viktor.govako@gmail.com> | 2015-07-03 20:23:05 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:54:14 +0300 |
commit | c966bfed30e064149cf8f9c6aa06d9281a5a5c21 (patch) | |
tree | d6b8bfc3fa7b822c16fd140f1c5461a39ea3f6ae /platform/platform.hpp | |
parent | 7494c3f57668407158a8ef12282e66328553295f (diff) |
[platform]
Replaced Platform::AddOptionalPath with Platform::SetResourceDir.
Added Platform::TestsDataPathForFile to read test files (usually placed in resource directory) in unit tests.
Diffstat (limited to 'platform/platform.hpp')
-rw-r--r-- | platform/platform.hpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/platform/platform.hpp b/platform/platform.hpp index 98de3e437f..930f488bba 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -52,9 +52,6 @@ public: protected: /// Usually read-only directory for application resources string m_resourcesDir; - /// Optional resource search path - string m_optionalDir; - /// Writable directory to store downloaded map data /// @note on some systems it can point to external ejectable storage string m_writableDir; @@ -88,11 +85,9 @@ public: static bool IsFileExistsByFullPath(string const & filePath); - /// @return void - void AddOptionalPath(string const & path) { m_optionalDir = path; } /// @return always the same writable dir for current user with slash at the end string WritableDir() const { return m_writableDir; } - /// @return set writable dir — use for testing and linux stuff only + /// Set writable dir — use for testing and linux stuff only void SetWritableDirForTests(string const & path) { m_writableDir = path; } /// @return full path to file in user's writable directory string WritablePathForFile(string const & file) const { return WritableDir() + file; } @@ -104,6 +99,9 @@ public: /// @return resource dir (on some platforms it's differ from Writable dir) string ResourcesDir() const { return m_resourcesDir; } + /// @note! This function is used in generator_tool and unit tests. + /// Client app should not replace default resource dir. + void SetResourceDir(string const & path) { m_resourcesDir = path; } /// Creates directory at filesystem EError MkDir(string const & dirName) const; @@ -118,6 +116,9 @@ public: /// @return full path to file in the temporary directory string TmpPathForFile(string const & file) const { return TmpDir() + file; } + /// @return full path to file where stored data for unit tests. + string TestsDataPathForFile(string const & file) const { return ReadPathForFile(file); } + /// @return path for directory in the persistent memory, can be the same /// as WritableDir, but on some platforms it's different string SettingsDir() const { return m_settingsDir; } @@ -209,7 +210,7 @@ public: string GetMemoryInfo() const; static EConnectionType ConnectionStatus(); - static bool IsConnected() { return ConnectionStatus() != EConnectionType::CONNECTION_NONE; }; + static bool IsConnected() { return ConnectionStatus() != EConnectionType::CONNECTION_NONE; } private: void GetSystemFontNames(FilesList & res) const; |