mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-26 17:12:03 +00:00
[nce, fs] tico support, fix FS bug that would nuke entire 'switch' folder (#4086)
Contains the minimal set of functionalities to allow tico installer succeed, and tico work normally EXCEPT for game launching (which me or someone else will investigate later) First three commits are from PR 4012. The other six, kinda dizzy to explain each one. All were implemented based on tico source, switchbrew and libnx. Hopefully the commit messages will do. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4086 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: Maufeat <sahyno1996@gmail.com>
This commit is contained in:
@@ -984,6 +984,22 @@ bool RegisteredCache::RemoveExistingEntry(u64 title_id) const {
|
||||
return removed_data;
|
||||
}
|
||||
|
||||
bool RegisteredCache::Delete(const NcaID& id) const {
|
||||
const auto path = GetRelativePathFromNcaID(id, false, true, false);
|
||||
|
||||
const bool is_file = dir->GetFileRelative(path) != nullptr;
|
||||
const bool is_dir = dir->GetDirectoryRelative(path) != nullptr;
|
||||
|
||||
if (is_file) {
|
||||
return dir->DeleteFile(path);
|
||||
}
|
||||
if (is_dir) {
|
||||
return dir->DeleteSubdirectoryRecursive(path);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFunction& copy,
|
||||
bool overwrite_if_exists,
|
||||
std::optional<NcaID> override_id) {
|
||||
|
||||
@@ -188,6 +188,7 @@ public:
|
||||
|
||||
// Removes an existing entry based on title id
|
||||
bool RemoveExistingEntry(u64 title_id) const;
|
||||
bool Delete(const NcaID& id) const;
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
|
||||
@@ -440,7 +440,7 @@ VirtualDir RealVfsDirectory::CreateDirectoryRelative(std::string_view relative_p
|
||||
|
||||
bool RealVfsDirectory::DeleteSubdirectoryRecursive(std::string_view name) {
|
||||
const auto full_path = FS::SanitizePath(this->path + '/' + std::string(name));
|
||||
return base.DeleteDirectory(full_path);
|
||||
return FS::RemoveDirRecursively(full_path);
|
||||
}
|
||||
|
||||
std::vector<VirtualFile> RealVfsDirectory::GetFiles() const {
|
||||
@@ -506,7 +506,7 @@ VirtualFile RealVfsDirectory::CreateFile(std::string_view name) {
|
||||
|
||||
bool RealVfsDirectory::DeleteSubdirectory(std::string_view name) {
|
||||
const std::string subdir_path = (path + '/').append(name);
|
||||
return base.DeleteDirectory(subdir_path);
|
||||
return FS::RemoveDir(subdir_path);
|
||||
}
|
||||
|
||||
bool RealVfsDirectory::DeleteFile(std::string_view name) {
|
||||
|
||||
Reference in New Issue
Block a user