mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-13 10:18:40 +12:00
Improve vfs::host::unlink on Windows (for sys_fs_rmdir)
Possibly fixes sys_fs_rmdir and other cases of directory removal. Make sure the directory with deleted files always becomes empty. For this purpose, temp files are moved to the root of the device.
This commit is contained in:
parent
cd843bda6e
commit
ccf9543b44
3 changed files with 12 additions and 5 deletions
|
@ -862,7 +862,9 @@ error_code sys_fs_unlink(ppu_thread& ppu, vm::cptr<char> path)
|
|||
const std::string_view vpath = path.get_ptr();
|
||||
const std::string local_path = vfs::get(vpath);
|
||||
|
||||
if (vpath.find_first_not_of('/') == -1)
|
||||
const std::size_t dev_start = vpath.find_first_not_of('/');
|
||||
|
||||
if (dev_start == -1)
|
||||
{
|
||||
return {CELL_EISDIR, path};
|
||||
}
|
||||
|
@ -877,7 +879,10 @@ error_code sys_fs_unlink(ppu_thread& ppu, vm::cptr<char> path)
|
|||
return {CELL_EISDIR, path};
|
||||
}
|
||||
|
||||
if (!vfs::host::unlink(local_path))
|
||||
// Size of "/dev_hdd0"-alike substring
|
||||
const std::size_t dev_size = vpath.find_first_of('/', dev_start);
|
||||
|
||||
if (!vfs::host::unlink(local_path, vfs::get(vpath.substr(0, dev_size))))
|
||||
{
|
||||
switch (auto error = fs::g_tls_error)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue