1
0
Fork 0
forked from suyu/suyu

renamed PSPFileInfo to just FileInfo

This commit is contained in:
ShizZy 2013-09-23 21:55:02 -04:00
parent 1af6ae2f48
commit 59020e8d9c
3 changed files with 21 additions and 21 deletions

View file

@ -56,12 +56,12 @@ private:
int handle_; int handle_;
}; };
struct PSPFileInfo { struct FileInfo {
PSPFileInfo() FileInfo()
: size(0), access(0), exists(false), type(FILETYPE_NORMAL), isOnSectorSystem(false), startSector(0), numSectors(0) {} : size(0), access(0), exists(false), type(FILETYPE_NORMAL), isOnSectorSystem(false), startSector(0), numSectors(0) {}
void DoState(PointerWrap &p) { void DoState(PointerWrap &p) {
auto s = p.Section("PSPFileInfo", 1); auto s = p.Section("FileInfo", 1);
if (!s) if (!s)
return; return;
@ -101,13 +101,13 @@ public:
virtual ~IFileSystem() {} virtual ~IFileSystem() {}
virtual void DoState(PointerWrap &p) = 0; virtual void DoState(PointerWrap &p) = 0;
virtual std::vector<PSPFileInfo> GetDirListing(std::string path) = 0; virtual std::vector<FileInfo> GetDirListing(std::string path) = 0;
virtual u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL) = 0; virtual u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL) = 0;
virtual void CloseFile(u32 handle) = 0; virtual void CloseFile(u32 handle) = 0;
virtual size_t ReadFile(u32 handle, u8 *pointer, s64 size) = 0; virtual size_t ReadFile(u32 handle, u8 *pointer, s64 size) = 0;
virtual size_t WriteFile(u32 handle, const u8 *pointer, s64 size) = 0; virtual size_t WriteFile(u32 handle, const u8 *pointer, s64 size) = 0;
virtual size_t SeekFile(u32 handle, s32 position, FileMove type) = 0; virtual size_t SeekFile(u32 handle, s32 position, FileMove type) = 0;
virtual PSPFileInfo GetFileInfo(std::string filename) = 0; virtual FileInfo GetFileInfo(std::string filename) = 0;
virtual bool OwnsHandle(u32 handle) = 0; virtual bool OwnsHandle(u32 handle) = 0;
virtual bool MkDir(const std::string &dirname) = 0; virtual bool MkDir(const std::string &dirname) = 0;
virtual bool RmDir(const std::string &dirname) = 0; virtual bool RmDir(const std::string &dirname) = 0;
@ -120,13 +120,13 @@ public:
class EmptyFileSystem : public IFileSystem { class EmptyFileSystem : public IFileSystem {
public: public:
virtual void DoState(PointerWrap &p) {} virtual void DoState(PointerWrap &p) {}
std::vector<PSPFileInfo> GetDirListing(std::string path) {std::vector<PSPFileInfo> vec; return vec;} std::vector<FileInfo> GetDirListing(std::string path) {std::vector<FileInfo> vec; return vec;}
u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL) {return 0;} u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL) {return 0;}
void CloseFile(u32 handle) {} void CloseFile(u32 handle) {}
size_t ReadFile(u32 handle, u8 *pointer, s64 size) {return 0;} size_t ReadFile(u32 handle, u8 *pointer, s64 size) {return 0;}
size_t WriteFile(u32 handle, const u8 *pointer, s64 size) {return 0;} size_t WriteFile(u32 handle, const u8 *pointer, s64 size) {return 0;}
size_t SeekFile(u32 handle, s32 position, FileMove type) {return 0;} size_t SeekFile(u32 handle, s32 position, FileMove type) {return 0;}
PSPFileInfo GetFileInfo(std::string filename) {PSPFileInfo f; return f;} FileInfo GetFileInfo(std::string filename) {FileInfo f; return f;}
bool OwnsHandle(u32 handle) {return false;} bool OwnsHandle(u32 handle) {return false;}
virtual bool MkDir(const std::string &dirname) {return false;} virtual bool MkDir(const std::string &dirname) {return false;}
virtual bool RmDir(const std::string &dirname) {return false;} virtual bool RmDir(const std::string &dirname) {return false;}

View file

@ -526,8 +526,8 @@ size_t DirectoryFileSystem::SeekFile(u32 handle, s32 position, FileMove type) {
} }
} }
PSPFileInfo DirectoryFileSystem::GetFileInfo(std::string filename) { FileInfo DirectoryFileSystem::GetFileInfo(std::string filename) {
PSPFileInfo x; FileInfo x;
x.name = filename; x.name = filename;
std::string fullName = GetLocalPath(filename); std::string fullName = GetLocalPath(filename);
@ -584,8 +584,8 @@ static void tmFromFiletime(tm &dest, FILETIME &src)
} }
#endif #endif
std::vector<PSPFileInfo> DirectoryFileSystem::GetDirListing(std::string path) { std::vector<FileInfo> DirectoryFileSystem::GetDirListing(std::string path) {
std::vector<PSPFileInfo> myVector; std::vector<FileInfo> myVector;
#ifdef _WIN32 #ifdef _WIN32
WIN32_FIND_DATA findData; WIN32_FIND_DATA findData;
HANDLE hFind; HANDLE hFind;
@ -599,7 +599,7 @@ std::vector<PSPFileInfo> DirectoryFileSystem::GetDirListing(std::string path) {
} }
while (true) { while (true) {
PSPFileInfo entry; FileInfo entry;
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
entry.type = FILETYPE_DIRECTORY; entry.type = FILETYPE_DIRECTORY;
else else
@ -642,7 +642,7 @@ std::vector<PSPFileInfo> DirectoryFileSystem::GetDirListing(std::string path) {
} }
while ((dirp = readdir(dp)) != NULL) { while ((dirp = readdir(dp)) != NULL) {
PSPFileInfo entry; FileInfo entry;
struct stat s; struct stat s;
std::string fullName = GetLocalPath(path) + "/"+dirp->d_name; std::string fullName = GetLocalPath(path) + "/"+dirp->d_name;
stat(fullName.c_str(), &s); stat(fullName.c_str(), &s);
@ -734,8 +734,8 @@ u32 VFSFileSystem::OpenFile(std::string filename, FileAccess access, const char
return newHandle; return newHandle;
} }
PSPFileInfo VFSFileSystem::GetFileInfo(std::string filename) { FileInfo VFSFileSystem::GetFileInfo(std::string filename) {
PSPFileInfo x; FileInfo x;
x.name = filename; x.name = filename;
std::string fullName = GetLocalPath(filename); std::string fullName = GetLocalPath(filename);
@ -809,8 +809,8 @@ bool VFSFileSystem::GetHostPath(const std::string &inpath, std::string &outpath)
return false; return false;
} }
std::vector<PSPFileInfo> VFSFileSystem::GetDirListing(std::string path) { std::vector<FileInfo> VFSFileSystem::GetDirListing(std::string path) {
std::vector<PSPFileInfo> myVector; std::vector<FileInfo> myVector;
// TODO // TODO
return myVector; return myVector;
} }

View file

@ -88,13 +88,13 @@ public:
~DirectoryFileSystem(); ~DirectoryFileSystem();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
std::vector<PSPFileInfo> GetDirListing(std::string path); std::vector<FileInfo> GetDirListing(std::string path);
u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL); u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL);
void CloseFile(u32 handle); void CloseFile(u32 handle);
size_t ReadFile(u32 handle, u8 *pointer, s64 size); size_t ReadFile(u32 handle, u8 *pointer, s64 size);
size_t WriteFile(u32 handle, const u8 *pointer, s64 size); size_t WriteFile(u32 handle, const u8 *pointer, s64 size);
size_t SeekFile(u32 handle, s32 position, FileMove type); size_t SeekFile(u32 handle, s32 position, FileMove type);
PSPFileInfo GetFileInfo(std::string filename); FileInfo GetFileInfo(std::string filename);
bool OwnsHandle(u32 handle); bool OwnsHandle(u32 handle);
bool MkDir(const std::string &dirname); bool MkDir(const std::string &dirname);
@ -125,13 +125,13 @@ public:
~VFSFileSystem(); ~VFSFileSystem();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
std::vector<PSPFileInfo> GetDirListing(std::string path); std::vector<FileInfo> GetDirListing(std::string path);
u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL); u32 OpenFile(std::string filename, FileAccess access, const char *devicename=NULL);
void CloseFile(u32 handle); void CloseFile(u32 handle);
size_t ReadFile(u32 handle, u8 *pointer, s64 size); size_t ReadFile(u32 handle, u8 *pointer, s64 size);
size_t WriteFile(u32 handle, const u8 *pointer, s64 size); size_t WriteFile(u32 handle, const u8 *pointer, s64 size);
size_t SeekFile(u32 handle, s32 position, FileMove type); size_t SeekFile(u32 handle, s32 position, FileMove type);
PSPFileInfo GetFileInfo(std::string filename); FileInfo GetFileInfo(std::string filename);
bool OwnsHandle(u32 handle); bool OwnsHandle(u32 handle);
bool MkDir(const std::string &dirname); bool MkDir(const std::string &dirname);