diff options
Diffstat (limited to 'Source/Core/Common/FileUtil.cpp')
| -rw-r--r-- | Source/Core/Common/FileUtil.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 0d41395209..450eeea0a5 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -78,19 +78,40 @@ FileInfo::FileInfo(const char* path) : FileInfo(std::string(path)) #else FileInfo::FileInfo(const std::string& path) : FileInfo(path.c_str()) { +#ifdef ANDROID + if (IsPathAndroidContent(path)) + AndroidContentInit(path); + else +#endif + m_exists = stat(path.c_str(), &m_stat) == 0; } FileInfo::FileInfo(const char* path) { - m_exists = stat(path, &m_stat) == 0; +#ifdef ANDROID + if (IsPathAndroidContent(path)) + AndroidContentInit(path); + else +#endif + m_exists = stat(path, &m_stat) == 0; } #endif FileInfo::FileInfo(int fd) { - m_exists = fstat(fd, &m_stat); + m_exists = fstat(fd, &m_stat) == 0; } +#ifdef ANDROID +void FileInfo::AndroidContentInit(const std::string& path) +{ + const jlong result = GetAndroidContentSizeAndIsDirectory(path); + m_exists = result != -1; + m_stat.st_mode = result == -2 ? S_IFDIR : S_IFREG; + m_stat.st_size = result >= 0 ? result : 0; +} +#endif + bool FileInfo::Exists() const { return m_exists; |
