From 046ca53f8c0827d37f5f7e009e0c3e2dfec74a10 Mon Sep 17 00:00:00 2001 From: "fires.gc" Date: Sat, 1 Nov 2008 15:59:06 +0000 Subject: 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 --- Source/Core/Common/Src/FileUtil.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'Source/Core/Common/Src/FileUtil.cpp') 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 -- cgit v1.2.3