summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/FileUtil.cpp
diff options
context:
space:
mode:
authorfires.gc <fires.gc@gmail.com>2008-11-01 15:59:06 +0000
committerfires.gc <fires.gc@gmail.com>2008-11-01 15:59:06 +0000
commit046ca53f8c0827d37f5f7e009e0c3e2dfec74a10 (patch)
tree27398d131817b47c3ccff3c2da84b85ff9598988 /Source/Core/Common/Src/FileUtil.cpp
parentdad9f74b0964a20f93d287fd2512007ad2c46e2e (diff)
updating the HLE FS and FileIO
added banner support of the savegames for wii... same games git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1031 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/FileUtil.cpp')
-rw-r--r--Source/Core/Common/Src/FileUtil.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp
index 742ec097ee..bc141a5517 100644
--- a/Source/Core/Common/Src/FileUtil.cpp
+++ b/Source/Core/Common/Src/FileUtil.cpp
@@ -48,6 +48,10 @@ bool Exists(const char *filename)
bool IsDirectory(const char *filename)
{
#ifdef _WIN32
+ DWORD Attribs = GetFileAttributes(filename);
+ if (Attribs == INVALID_FILE_ATTRIBUTES)
+ return false;
+
return (GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY) != 0;
#else
struct stat file_info;
@@ -163,11 +167,15 @@ std::string GetUserDirectory()
u64 GetSize(const char *filename)
{
- FILE *f = fopen(filename, "rb");
- fseek(f, 0, SEEK_END);
- u64 pos = ftell(f);
- fclose(f);
- return pos;
+ FILE *pFile = fopen(filename, "rb");
+ if (pFile)
+ {
+ fseek(pFile, 0, SEEK_END);
+ u64 pos = ftell(pFile);
+ fclose(pFile);
+ return pos;
+ }
+ return 0;
}
#ifdef _WIN32
@@ -236,4 +244,14 @@ u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry)
}
#endif
+bool CreateEmptyFile(const char *filename)
+{
+ FILE* pFile = fopen(filename, "wb");
+ if (pFile == NULL)
+ return false;
+
+ fclose(pFile);
+ return true;
+}
+
} // namespace