Files
Henrique Reis NevesandClaude Opus 5.5 22bb35f3c0 io: refuse to remove a directory that isn't empty or isn't a directory
* io: refuse to remove a directory that isn't empty or isn't a directory

sceIoRmdir removed its path with fs::remove_all, so on a directory that
wasn't empty it deleted everything inside and returned 0, and on a file it
deleted the file and returned 0. The Vita refuses both, with ENOTEMPTY
(0x8001005A) and ENOTDIR (0x80010014), as the VitaAutotests directories
test shows.

remove_dir now checks both before it removes anything. The save data
remove calls of SceAppUtil and SceAppMgr still remove a directory with
what it holds, which they rely on, by asking for a recursive remove.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* io: keep removing save data files, rmdir without remove_all

The save data remove calls of SceAppUtil and SceAppMgr check for a regular
file on the savedata0: path itself, not on the host path it maps to, so
they hand files to remove_dir as well. The ENOTDIR check left those files
in place. A recursive remove now takes whatever is at the path, as before.

sceIoRmdir removes with fs::remove, which refuses a directory that isn't
empty, so an entry added after the check isn't deleted with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* io: check for an empty directory before sceIoRmdir removes it

remove_dir now checks that the path is a directory and that it is empty
before it removes it, instead of working out why fs::remove failed. The
removal is still fs::remove, so an entry added after the check makes it
fail rather than get deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* io: return ENOTEMPTY when an entry appears after sceIoRmdir's check

If an entry is added to the directory between the empty check and the
removal, fs::remove fails with directory_not_empty. remove_dir now returns
ENOTEMPTY for that failure instead of ENOENT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 11:40:16 -03:00
..
2026-05-13 17:58:56 -04:00
2022-03-16 02:11:11 +01:00