mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-28 11:49:06 +00:00
Android: Add content provider support to File::FileInfo
This commit is contained in:
parent
99ffee9a0a
commit
a7c05d7e84
7 changed files with 73 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue