Changeset View
Changeset View
Standalone View
Standalone View
source/ps/SavedGame.cpp
Show First 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
bool SavedGames::DeleteSavedGame(const std::wstring& name) | bool SavedGames::DeleteSavedGame(const std::wstring& name) | ||||
{ | { | ||||
const VfsPath basename(L"saves/" + name); | const VfsPath basename(L"saves/" + name); | ||||
const VfsPath filename = basename.ChangeExtension(L".0adsave"); | const VfsPath filename = basename.ChangeExtension(L".0adsave"); | ||||
OsPath realpath; | OsPath realpath; | ||||
// Make sure it exists in VFS and find its real path | // Make sure it exists in VFS and find its path | ||||
if (!VfsFileExists(filename) || g_VFS->GetRealPath(filename, realpath) != INFO::OK) | if (!VfsFileExists(filename) || g_VFS->GetOriginalPath(filename, realpath) != INFO::OK) | ||||
return false; // Error | return false; // Error | ||||
// Remove from VFS | // Remove from VFS | ||||
if (g_VFS->RemoveFile(filename) != INFO::OK) | if (g_VFS->RemoveFile(filename) != INFO::OK) | ||||
return false; // Error | return false; // Error | ||||
// Delete actual file | // Delete actual file | ||||
if (wunlink(realpath) != 0) | if (wunlink(realpath) != 0) | ||||
return false; // Error | return false; // Error | ||||
// Successfully deleted file | // Successfully deleted file | ||||
return true; | return true; | ||||
} | } |
Wildfire Games · Phabricator