Fix code for Android

This commit is contained in:
JusicP
2021-08-20 19:56:20 +03:00
parent 557c300975
commit 7a91fbebd9
19 changed files with 405 additions and 18 deletions

View File

@@ -3770,8 +3770,10 @@ bool CBaseFileSystem::IsFileWritable( char const *pFileName, char const *pPathID
{
#ifdef WIN32
if( buf.st_mode & _S_IWRITE )
#elif LINUX
#elif defined (LINUX) && !defined (ANDROID)
if( buf.st_mode & S_IWRITE )
#elif ANDROID
if( buf.st_mode & S_IWUSR )
#else
if( buf.st_mode & S_IWRITE )
#endif
@@ -3792,8 +3794,10 @@ bool CBaseFileSystem::IsFileWritable( char const *pFileName, char const *pPathID
{
#ifdef WIN32
if ( buf.st_mode & _S_IWRITE )
#elif LINUX
#elif defined (LINUX) && !defined (ANDROID)
if ( buf.st_mode & S_IWRITE )
#elif ANDROID
if ( buf.st_mode & S_IWUSR )
#else
if ( buf.st_mode & S_IWRITE )
#endif
@@ -3812,6 +3816,8 @@ bool CBaseFileSystem::SetFileWritable( char const *pFileName, bool writable, con
#ifdef _WIN32
int pmode = writable ? ( _S_IWRITE | _S_IREAD ) : ( _S_IREAD );
#elif ANDROID
int pmode = writable ? ( S_IWUSR | S_IRUSR ) : ( S_IRUSR );
#else
int pmode = writable ? ( S_IWRITE | S_IREAD ) : ( S_IREAD );
#endif

View File

@@ -972,7 +972,11 @@ void CStdioFile::FS_fclose()
AUTO_LOCK( m_MutexLockedFD );
struct _stat buf;
#ifdef ANDROID
int fd = fileno( m_pFile ); // need to test this
#else
int fd = fileno_unlocked( m_pFile );
#endif
fstat( fd, &buf );
fflush( m_pFile );