mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-22 10:50:15 -10:00
path_remove_tree() removes a file, or a directory with everything in it, hidden entries included; nothing at the path counts as removed. A link to a directory is removed, not followed: each directory entry is first tried with rmdir (an empty directory, or a link on Windows) and unlink (a link elsewhere), and only a real directory with something in it is walked. One path buffer for the whole walk, grown in place. path_copy_tree() copies a file, or a directory with everything in it, making the destination's directories as needed and replacing files already there. Each file goes through retro_vfs_copy_begin_impl in one step, so the platform's own copy (a clone where the file system can make one) moves the bytes with no buffer of ours. Both go through the built-in VFS, as path_rmdir and path_is_empty_directory do, and add no VFS backend function. For parallel-ps4, whose save data, PKG install and app content code removes and copies directory trees through std::filesystem. samples/file/file_path/path_tree_test: copies at every depth, a hidden file, an empty directory, trailing separators, copying over an existing copy, a single file, removal, and a link to a directory outside the tree being removed without what it points to; passes on Linux under ASan/UBSan and on Windows (MinGW, under wine). Run by the libretro-common samples workflow.