IOS/FS: Implement Format properly

This commit is contained in:
Léo Lam 2019-12-28 20:31:21 +01:00
parent a83d9e5600
commit 36676d2628
1 changed files with 8 additions and 0 deletions

View File

@ -334,9 +334,17 @@ void HostFileSystem::DoState(PointerWrap& p)
ResultCode HostFileSystem::Format(Uid uid)
{
if (uid != 0)
return ResultCode::AccessDenied;
if (m_root_path.empty())
return ResultCode::AccessDenied;
const std::string root = BuildFilename("/");
if (!File::DeleteDirRecursively(root) || !File::CreateDir(root))
return ResultCode::UnknownError;
ResetFst();
SaveFst();
// Reset and close all handles.
m_handles = {};
return ResultCode::Success;
}