diff options
author | Alex Zolotarev <deathbaba@gmail.com> | 2011-10-31 00:14:52 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:27:10 +0300 |
commit | eea66458919753af7edc32b9210adfa1a1f36751 (patch) | |
tree | 4545e07fbda279938b77b45069c7973c2437a857 /platform/platform.hpp | |
parent | 29f6e38b349ca9620ed36a637c692fbccb12eb32 (diff) |
Completed platform refactoring and fixed paths for resources/writable dirs
Diffstat (limited to 'platform/platform.hpp')
-rw-r--r-- | platform/platform.hpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/platform/platform.hpp b/platform/platform.hpp index 793f8bacb1..ad745ae478 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -16,8 +16,22 @@ class Platform protected: string m_writableDir, m_resourcesDir; class PlatformImpl; + /// Used only on those platforms where needed PlatformImpl * m_impl; + /// Internal function to use files from writable dir if they override the same in the resources + string ReadPathForFile(string const & file) const + { + string fullPath = m_writableDir + file; + if (!IsFileExists(fullPath)) + { + fullPath = m_resourcesDir + file; + if (!IsFileExists(fullPath)) + MYTHROW(FileAbsentException, ("File doesn't exist", fullPath)); + } + return fullPath; + } + public: Platform(); ~Platform(); @@ -46,11 +60,7 @@ public: /// @return false if file is not exist bool GetFileSize(string const & file, uint64_t & size) const; /// Simple file existing check - bool IsFileExists(string const & file) const - { - uint64_t dummy; - return GetFileSize(file, dummy); - } + bool IsFileExists(string const & file) const; //@} int CpuCores() const; |