mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Android: Add content provider support to File::FileInfo
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user