mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Fix build with NDK 15. This does force us to make do with 32-bit file sizes...
This commit is contained in:
parent
7da5dfcdd7
commit
e6e96c0d89
@ -443,8 +443,13 @@ bool GetFileDetails(const std::string &filename, FileDetails *details) {
|
||||
if (!Exists(filename)) {
|
||||
return false;
|
||||
}
|
||||
#if __ANDROID__ && __ANDROID_API__ < 21
|
||||
struct stat buf;
|
||||
if (stat(filename.c_str(), &buf) == 0) {
|
||||
#else
|
||||
struct stat64 buf;
|
||||
if (stat64(filename.c_str(), &buf) == 0) {
|
||||
#endif
|
||||
details->size = buf.st_size;
|
||||
details->isDirectory = S_ISDIR(buf.st_mode);
|
||||
details->atime = buf.st_atime;
|
||||
@ -506,9 +511,14 @@ u64 GetFileSize(const std::string &filename) {
|
||||
if (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
return 0;
|
||||
return ((u64)attr.nFileSizeHigh << 32) | (u64)attr.nFileSizeLow;
|
||||
#else
|
||||
#if __ANDROID__ && __ANDROID_API__ < 21
|
||||
struct stat file_info;
|
||||
int result = stat(filename.c_str(), &file_info);
|
||||
#else
|
||||
struct stat64 file_info;
|
||||
int result = stat64(filename.c_str(), &file_info);
|
||||
#endif
|
||||
if (result != 0) {
|
||||
WARN_LOG(COMMON, "GetSize: failed %s: No such file", filename.c_str());
|
||||
return 0;
|
||||
|
@ -153,12 +153,16 @@ bool getFileInfo(const char *path, FileInfo *fileInfo) {
|
||||
fileInfo->isWritable = (attrs.dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0;
|
||||
fileInfo->exists = true;
|
||||
#else
|
||||
struct stat64 file_info;
|
||||
|
||||
std::string copy(path);
|
||||
|
||||
#ifdef __ANDROID__ && __ANDROID_API__ < 21
|
||||
struct stat file_info;
|
||||
int result = stat(copy.c_str(), &file_info);
|
||||
#else
|
||||
struct stat64 file_info;
|
||||
int result = stat64(copy.c_str(), &file_info);
|
||||
|
||||
#endif
|
||||
if (result < 0) {
|
||||
WLOG("IsDirectory: stat failed on %s", path);
|
||||
fileInfo->exists = false;
|
||||
|
@ -183,7 +183,7 @@ bool ZipAssetReader::GetFileListing(const char *orig_path, std::vector<FileInfo>
|
||||
continue;
|
||||
if (!memcmp(name, path, pathlen)) {
|
||||
// The prefix is right. Let's see if this is a file or path.
|
||||
char *slashPos = strchr(name + pathlen + 1, '/');
|
||||
const char *slashPos = strchr(name + pathlen + 1, '/');
|
||||
if (slashPos != 0) {
|
||||
// A directory.
|
||||
std::string dirName = std::string(name + pathlen + 1, slashPos - (name + pathlen + 1));
|
||||
|
Loading…
Reference in New Issue
Block a user