diff --git a/src/xenia/base/filesystem.h b/src/xenia/base/filesystem.h index f936cc14f..036a6a7a4 100644 --- a/src/xenia/base/filesystem.h +++ b/src/xenia/base/filesystem.h @@ -59,10 +59,6 @@ int64_t Tell(FILE* file); // undefined. bool TruncateStdioFile(FILE* file, uint64_t length); -// Deletes the file at the given path. -// Returns true if the file was found and removed. -bool DeleteFile(const std::filesystem::path& path); - struct FileAccess { // Implies kFileReadData. static const uint32_t kGenericRead = 0x80000000; diff --git a/src/xenia/base/filesystem_posix.cc b/src/xenia/base/filesystem_posix.cc index c5bf420b0..497c98bd3 100644 --- a/src/xenia/base/filesystem_posix.cc +++ b/src/xenia/base/filesystem_posix.cc @@ -131,11 +131,6 @@ bool CreateFile(const std::filesystem::path& path) { return false; } -bool DeleteFile(const std::filesystem::path& path) { - // TODO: proper implementation. - return (path.c_str()) == 0 ? true : false; -} - class PosixFileHandle : public FileHandle { public: PosixFileHandle(std::filesystem::path path, int handle) diff --git a/src/xenia/base/filesystem_win.cc b/src/xenia/base/filesystem_win.cc index 53c8052c7..70eda4499 100644 --- a/src/xenia/base/filesystem_win.cc +++ b/src/xenia/base/filesystem_win.cc @@ -13,7 +13,6 @@ #include #undef CreateFile -#undef DeleteFile #include "xenia/base/filesystem.h" #include "xenia/base/logging.h" @@ -104,10 +103,6 @@ bool TruncateStdioFile(FILE* file, uint64_t length) { return true; } -bool DeleteFile(const std::filesystem::path& path) { - return DeleteFileW(path.c_str()) ? true : false; -} - class Win32FileHandle : public FileHandle { public: Win32FileHandle(const std::filesystem::path& path, HANDLE handle) diff --git a/src/xenia/vfs/devices/host_path_entry.cc b/src/xenia/vfs/devices/host_path_entry.cc index 96f0399d9..04c9e2dc8 100644 --- a/src/xenia/vfs/devices/host_path_entry.cc +++ b/src/xenia/vfs/devices/host_path_entry.cc @@ -102,7 +102,8 @@ bool HostPathEntry::DeleteEntryInternal(Entry* entry) { return std::filesystem::remove_all(full_path); } else { // Delete file. - return xe::filesystem::DeleteFile(full_path); + return !std::filesystem::is_directory(full_path) && + std::filesystem::remove(full_path); } }