VFS: RemoveDirectoryW on a non-empty game folder succeeds and hides the folder in every later run #991
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by Conrage on 2026-11-24T10:06:38Z.
RemoveDirectoryWon a game path goes toVfs::remove_dir, which never checks that the merged directory is empty:github.com/ivall/xcl@9aec53d/crates/xcl/src/vfs.rs (L635-L662)On Windows,
RemoveDirectoryWon a non-empty directory fails withERROR_DIR_NOT_EMPTY(145). Under XCL it returns success and the whole subtree disappears from the title's view. Whiteouts are saved tooverlay\.xcl_whiteoutsand loaded on start, so the folder stays hidden in every later run until the overlay is cleared.The repo's own test already shows the behaviour (
directoriesinvfs.rs, line 852): the fixture'sdatafolder holdshello.txtandgone.txt, andremove_dir("data")returnsOk(()).Why it matters: "remove the folder if it's empty" is a common cleanup pattern: call
RemoveDirectoryWon each folder and ignore the failure. A title doing that over its install folder would lose game data folders permanently under XCL.Expected:
remove_dirreturnsERROR_DIR_NOT_EMPTYwhen the merged view of the folder (overlay entries plus game entries that aren't whited out) has any entry. It only whites out an empty folder.Suggested fix: in
remove_dir, list the merged directory (asFindFirstFilealready does for listings) and refuse when it isn't empty. Adjust thedirectoriestest to match Win32.Not tested: found by reading the code and the existing unit test; not run (no Windows machine).
AI use: found, checked and written up by Claude Code (Claude Opus 5.5) at my request.
Imported from ivall/xcl. Originally posted by ivall on 2026-11-24T11:04:43Z.
Fixed by #1016 (
47efa2e):RemoveDirectoryWon a game folder fails withERROR_DIR_NOT_EMPTYwhile its merged view has visible entries, and the overlay is left as it was.