mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-20 18:05:11 -04:00
boot2: clean up pre-0.19.0 ams contents on upgrade
This commit is contained in:
parent
79e4c82d7e
commit
c8404e8452
5 changed files with 127 additions and 25 deletions
|
@ -52,6 +52,26 @@ namespace ams::cfg {
|
|||
return has_file;
|
||||
}
|
||||
|
||||
Result DeleteFlagFile(const char *flag_path) {
|
||||
/* We need the SD card to be available to delete anything. */
|
||||
AMS_ABORT_UNLESS(IsSdCardInitialized());
|
||||
|
||||
/* Mount the sd card. */
|
||||
char mount_name[fs::MountNameLengthMax + 1];
|
||||
GetFlagMountName(mount_name);
|
||||
R_TRY(fs::MountSdCard(mount_name));
|
||||
ON_SCOPE_EXIT { fs::Unmount(mount_name); };
|
||||
|
||||
/* Get the flag path. */
|
||||
char full_path[fs::EntryNameLengthMax + 1];
|
||||
util::SNPrintf(full_path, sizeof(full_path), "%s:/%s", mount_name, flag_path[0] == '/' ? flag_path + 1 : flag_path);
|
||||
|
||||
/* Delete the file. */
|
||||
R_TRY(fs::DeleteFile(full_path));
|
||||
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Flag utilities. */
|
||||
|
@ -77,4 +97,10 @@ namespace ams::cfg {
|
|||
return HasGlobalFlag(hbl_flag);
|
||||
}
|
||||
|
||||
Result DeleteGlobalFlag(const char *flag) {
|
||||
char global_flag[fs::EntryNameLengthMax + 1];
|
||||
util::SNPrintf(global_flag, sizeof(global_flag) - 1, "/atmosphere/flags/%s.flag", flag);
|
||||
return DeleteFlagFile(global_flag);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue