Preserve CyberFoil across clean install backup/restore.
All checks were successful
Build / Build (push) Successful in 13s
All checks were successful
Build / Build (push) Successful in 13s
Back up cyberfoil.nro, config.json, and remotes/ when sd:/switch/CyberFoil exists, then restore them after the wipe.
This commit is contained in:
@@ -39,6 +39,35 @@ int backup_user_data(void) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
// Backup CyberFoil (nro, config, remotes) if installed
|
||||
if (path_exists(CYBERFOIL_DIR)) {
|
||||
res = f_mkdir(TEMP_BACKUP_CYBERFOIL);
|
||||
if (res != FR_OK && res != FR_EXIST) {
|
||||
return res;
|
||||
}
|
||||
|
||||
if (path_exists(CYBERFOIL_NRO)) {
|
||||
res = file_copy(CYBERFOIL_NRO, TEMP_BACKUP_CYBERFOIL_NRO);
|
||||
if (res != FR_OK) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
if (path_exists(CYBERFOIL_CONFIG)) {
|
||||
res = file_copy(CYBERFOIL_CONFIG, TEMP_BACKUP_CYBERFOIL_CONFIG);
|
||||
if (res != FR_OK) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
if (path_exists(CYBERFOIL_REMOTES)) {
|
||||
res = folder_copy(CYBERFOIL_REMOTES, TEMP_BACKUP_CYBERFOIL);
|
||||
if (res != FR_OK) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FR_OK;
|
||||
}
|
||||
@@ -72,6 +101,35 @@ int restore_user_data(void) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
// Restore CyberFoil if backed up
|
||||
if (path_exists(TEMP_BACKUP_CYBERFOIL)) {
|
||||
res = f_mkdir(CYBERFOIL_DIR);
|
||||
if (res != FR_OK && res != FR_EXIST) {
|
||||
return res;
|
||||
}
|
||||
|
||||
if (path_exists(TEMP_BACKUP_CYBERFOIL_NRO)) {
|
||||
res = file_copy(TEMP_BACKUP_CYBERFOIL_NRO, CYBERFOIL_NRO);
|
||||
if (res != FR_OK) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
if (path_exists(TEMP_BACKUP_CYBERFOIL_CONFIG)) {
|
||||
res = file_copy(TEMP_BACKUP_CYBERFOIL_CONFIG, CYBERFOIL_CONFIG);
|
||||
if (res != FR_OK) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
if (path_exists(TEMP_BACKUP_CYBERFOIL_REMOTES)) {
|
||||
res = folder_copy(TEMP_BACKUP_CYBERFOIL_REMOTES, CYBERFOIL_DIR);
|
||||
if (res != FR_OK) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FR_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user