mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Io: Cleanup access bits for files.
Also, we default a lot of these members, so don't need to reset.
This commit is contained in:
parent
9b112efa0b
commit
d7ad43b1d9
5 changed files with 25 additions and 37 deletions
|
@ -742,11 +742,6 @@ PSPFileInfo DirectoryFileSystem::GetFileInfo(std::string filename) {
|
|||
File::FileDetails details;
|
||||
if (!File::GetFileDetails(fullName, &details)) {
|
||||
ERROR_LOG(FILESYS, "DirectoryFileSystem::GetFileInfo: GetFileDetails failed: %s", fullName.c_str());
|
||||
x.size = 0;
|
||||
x.access = 0;
|
||||
memset(&x.atime, 0, sizeof(x.atime));
|
||||
memset(&x.ctime, 0, sizeof(x.ctime));
|
||||
memset(&x.mtime, 0, sizeof(x.mtime));
|
||||
} else {
|
||||
x.size = details.size;
|
||||
x.access = details.access;
|
||||
|
@ -1094,6 +1089,7 @@ PSPFileInfo VFSFileSystem::GetFileInfo(std::string filename) {
|
|||
if (x.exists) {
|
||||
x.size = fo.size;
|
||||
x.type = fo.isDirectory ? FILETYPE_DIRECTORY : FILETYPE_NORMAL;
|
||||
x.access = fo.isWritable ? 0666 : 0444;
|
||||
}
|
||||
} else {
|
||||
x.exists = false;
|
||||
|
|
|
@ -88,29 +88,25 @@ private:
|
|||
};
|
||||
|
||||
struct PSPFileInfo {
|
||||
PSPFileInfo()
|
||||
: size(0), access(0), exists(false), type(FILETYPE_NORMAL), isOnSectorSystem(false), startSector(0), numSectors(0), sectorSize(0) {
|
||||
memset(&ctime, 0, sizeof(ctime));
|
||||
memset(&atime, 0, sizeof(atime));
|
||||
memset(&mtime, 0, sizeof(mtime));
|
||||
PSPFileInfo() {
|
||||
}
|
||||
|
||||
void DoState(PointerWrap &p);
|
||||
|
||||
std::string name;
|
||||
s64 size;
|
||||
u32 access; //unix 777
|
||||
bool exists;
|
||||
FileType type;
|
||||
s64 size = 0;
|
||||
u32 access = 0; //unix 777
|
||||
bool exists = false;
|
||||
FileType type = FILETYPE_NORMAL;
|
||||
|
||||
tm atime;
|
||||
tm ctime;
|
||||
tm mtime;
|
||||
tm atime{};
|
||||
tm ctime{};
|
||||
tm mtime{};
|
||||
|
||||
bool isOnSectorSystem;
|
||||
u32 startSector;
|
||||
u32 numSectors;
|
||||
u32 sectorSize;
|
||||
bool isOnSectorSystem = false;
|
||||
u32 startSector = 0;
|
||||
u32 numSectors = 0;
|
||||
u32 sectorSize = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -617,6 +617,7 @@ PSPFileInfo ISOFileSystem::GetFileInfo(std::string filename) {
|
|||
fileInfo.exists = true;
|
||||
fileInfo.type = FILETYPE_NORMAL;
|
||||
fileInfo.size = readSize;
|
||||
fileInfo.access = 0444;
|
||||
fileInfo.startSector = sectorStart;
|
||||
fileInfo.isOnSectorSystem = true;
|
||||
fileInfo.numSectors = (readSize + sectorSize - 1) / sectorSize;
|
||||
|
@ -625,12 +626,10 @@ PSPFileInfo ISOFileSystem::GetFileInfo(std::string filename) {
|
|||
|
||||
TreeEntry *entry = GetFromPath(filename, false);
|
||||
PSPFileInfo x;
|
||||
if (!entry) {
|
||||
x.size = 0;
|
||||
x.exists = false;
|
||||
} else {
|
||||
if (entry) {
|
||||
x.name = entry->name;
|
||||
x.access = FILEACCESS_READ;
|
||||
// Strangely, it seems to be executable even for files.
|
||||
x.access = 0555;
|
||||
x.size = entry->size;
|
||||
x.exists = true;
|
||||
x.type = entry->isDirectory ? FILETYPE_DIRECTORY : FILETYPE_NORMAL;
|
||||
|
@ -658,16 +657,14 @@ std::vector<PSPFileInfo> ISOFileSystem::GetDirListing(std::string path) {
|
|||
|
||||
PSPFileInfo x;
|
||||
x.name = e->name;
|
||||
x.access = FILEACCESS_READ;
|
||||
// Strangely, it seems to be executable even for files.
|
||||
x.access = 0555;
|
||||
x.size = e->size;
|
||||
x.type = e->isDirectory ? FILETYPE_DIRECTORY : FILETYPE_NORMAL;
|
||||
x.isOnSectorSystem = true;
|
||||
x.startSector = e->startingPosition/2048;
|
||||
x.sectorSize = sectorSize;
|
||||
x.numSectors = (u32)((e->size + sectorSize - 1) / sectorSize);
|
||||
memset(&x.atime, 0, sizeof(x.atime));
|
||||
memset(&x.mtime, 0, sizeof(x.mtime));
|
||||
memset(&x.ctime, 0, sizeof(x.ctime));
|
||||
myVector.push_back(x);
|
||||
}
|
||||
return myVector;
|
||||
|
|
|
@ -370,7 +370,7 @@ PSPFileInfo MetaFileSystem::GetFileInfo(std::string filename)
|
|||
}
|
||||
else
|
||||
{
|
||||
PSPFileInfo bogus; // TODO
|
||||
PSPFileInfo bogus;
|
||||
return bogus;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -571,6 +571,7 @@ PSPFileInfo VirtualDiscFileSystem::GetFileInfo(std::string filename) {
|
|||
fileInfo.exists = true;
|
||||
fileInfo.type = FILETYPE_NORMAL;
|
||||
fileInfo.size = readSize;
|
||||
fileInfo.access = 0444;
|
||||
fileInfo.startSector = sectorStart;
|
||||
fileInfo.isOnSectorSystem = true;
|
||||
fileInfo.numSectors = (readSize + 2047) / 2048;
|
||||
|
@ -582,6 +583,7 @@ PSPFileInfo VirtualDiscFileSystem::GetFileInfo(std::string filename) {
|
|||
x.type = FILETYPE_NORMAL;
|
||||
x.isOnSectorSystem = true;
|
||||
x.startSector = fileList[fileIndex].firstBlock;
|
||||
x.access = 0555;
|
||||
|
||||
HandlerFileHandle temp = fileList[fileIndex].handler;
|
||||
if (temp.Open(basePath, filename, FILEACCESS_READ)) {
|
||||
|
@ -610,6 +612,7 @@ PSPFileInfo VirtualDiscFileSystem::GetFileInfo(std::string filename) {
|
|||
|
||||
x.type = File::IsDirectory(fullName) ? FILETYPE_DIRECTORY : FILETYPE_NORMAL;
|
||||
x.exists = true;
|
||||
x.access = 0555;
|
||||
if (fileIndex != -1) {
|
||||
x.isOnSectorSystem = true;
|
||||
x.startSector = fileList[fileIndex].firstBlock;
|
||||
|
@ -621,12 +624,8 @@ PSPFileInfo VirtualDiscFileSystem::GetFileInfo(std::string filename) {
|
|||
ERROR_LOG(FILESYS, "DirectoryFileSystem::GetFileInfo: GetFileDetails failed: %s", fullName.c_str());
|
||||
x.size = 0;
|
||||
x.access = 0;
|
||||
memset(&x.atime, 0, sizeof(x.atime));
|
||||
memset(&x.ctime, 0, sizeof(x.ctime));
|
||||
memset(&x.mtime, 0, sizeof(x.mtime));
|
||||
} else {
|
||||
x.size = details.size;
|
||||
x.access = details.access;
|
||||
time_t atime = details.atime;
|
||||
time_t ctime = details.ctime;
|
||||
time_t mtime = details.mtime;
|
||||
|
@ -691,7 +690,7 @@ std::vector<PSPFileInfo> VirtualDiscFileSystem::GetDirListing(std::string path)
|
|||
entry.type = FILETYPE_NORMAL;
|
||||
}
|
||||
|
||||
entry.access = FILEACCESS_READ;
|
||||
entry.access = 0555;
|
||||
entry.size = findData.nFileSizeLow | ((u64)findData.nFileSizeHigh<<32);
|
||||
entry.name = ConvertWStringToUTF8(findData.cFileName);
|
||||
tmFromFiletime(entry.atime, findData.ftLastAccessTime);
|
||||
|
@ -737,7 +736,7 @@ std::vector<PSPFileInfo> VirtualDiscFileSystem::GetDirListing(std::string path)
|
|||
entry.type = FILETYPE_DIRECTORY;
|
||||
else
|
||||
entry.type = FILETYPE_NORMAL;
|
||||
entry.access = s.st_mode & 0x1FF;
|
||||
entry.access = 0555;
|
||||
entry.name = dirp->d_name;
|
||||
entry.size = s.st_size;
|
||||
localtime_r((time_t*)&s.st_atime,&entry.atime);
|
||||
|
|
Loading…
Add table
Reference in a new issue