Install: copy all staging root files via directory iteration
All checks were successful
Build / Build (push) Successful in 18s
All checks were successful
Build / Build (push) Successful in 18s
Made-with: Cursor
This commit is contained in:
@@ -113,6 +113,38 @@ void install_combine_path(char *result, size_t size, const char *base, const cha
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy every regular file at staging root to dst_root; subdirs and volume labels skipped. */
|
||||
int install_copy_staging_root_files(const char *staging, const char *dst_root) {
|
||||
DIR dir;
|
||||
FILINFO fno;
|
||||
char src_full[256];
|
||||
char dst_full[256];
|
||||
int res = f_opendir(&dir, staging);
|
||||
if (res != FR_OK)
|
||||
return res;
|
||||
|
||||
while (1) {
|
||||
res = f_readdir(&dir, &fno);
|
||||
if (res != FR_OK || fno.fname[0] == 0)
|
||||
break;
|
||||
if (fno.fname[0] == '.' && (fno.fname[1] == '\0' || (fno.fname[1] == '.' && fno.fname[2] == '\0')))
|
||||
continue;
|
||||
if (fno.fattrib & (AM_DIR | AM_VOL))
|
||||
continue;
|
||||
|
||||
install_combine_path(src_full, sizeof(src_full), staging, fno.fname);
|
||||
install_combine_path(dst_full, sizeof(dst_full), dst_root, fno.fname);
|
||||
res = file_copy(src_full, dst_full);
|
||||
if (res != FR_OK) {
|
||||
f_closedir(&dir);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
f_closedir(&dir);
|
||||
return FR_OK;
|
||||
}
|
||||
|
||||
// Recursive folder copy with progress tracking
|
||||
static int folder_copy_progress_recursive(const char *src, const char *dst, int *copied, int total, u32 start_x, u32 start_y, const char *display_name, int *last_percent) {
|
||||
DIR dir;
|
||||
|
||||
@@ -35,6 +35,7 @@ void install_check_and_clear_screen_if_needed(void);
|
||||
bool install_path_exists(const char *path);
|
||||
int install_count_directory_items(const char *path);
|
||||
void install_combine_path(char *result, size_t size, const char *base, const char *add);
|
||||
int install_copy_staging_root_files(const char *staging, const char *dst_root);
|
||||
int delete_path_list(const char* paths[], const char* description);
|
||||
int delete_path_lists_grouped(const char *folder_display_name, ...);
|
||||
int folder_delete_single_with_progress(const char *path, const char *display_name);
|
||||
|
||||
@@ -78,7 +78,6 @@ int update_mode_install(omninx_variant_t variant) {
|
||||
int res;
|
||||
const char* staging = get_staging_path(variant);
|
||||
char src_path[256];
|
||||
char dst_path[256];
|
||||
|
||||
if (!staging) {
|
||||
return FR_INVALID_PARAMETER;
|
||||
@@ -124,29 +123,9 @@ int update_mode_install(omninx_variant_t variant) {
|
||||
gfx_printf(" Kopiere Root-Dateien...\n");
|
||||
set_color(COLOR_WHITE);
|
||||
|
||||
s_printf(src_path, "%s/boot.dat", staging);
|
||||
s_printf(dst_path, "sd:/boot.dat");
|
||||
if (path_exists(src_path)) file_copy(src_path, dst_path);
|
||||
|
||||
s_printf(src_path, "%s/boot.ini", staging);
|
||||
s_printf(dst_path, "sd:/boot.ini");
|
||||
if (path_exists(src_path)) file_copy(src_path, dst_path);
|
||||
|
||||
s_printf(src_path, "%s/exosphere.ini", staging);
|
||||
s_printf(dst_path, "sd:/exosphere.ini");
|
||||
if (path_exists(src_path)) file_copy(src_path, dst_path);
|
||||
|
||||
s_printf(src_path, "%s/hbmenu.nro", staging);
|
||||
s_printf(dst_path, "sd:/hbmenu.nro");
|
||||
if (path_exists(src_path)) file_copy(src_path, dst_path);
|
||||
|
||||
s_printf(src_path, "%s/loader.bin", staging);
|
||||
s_printf(dst_path, "sd:/loader.bin");
|
||||
if (path_exists(src_path)) file_copy(src_path, dst_path);
|
||||
|
||||
s_printf(src_path, "%s/payload.bin", staging);
|
||||
s_printf(dst_path, "sd:/payload.bin");
|
||||
if (path_exists(src_path)) file_copy(src_path, dst_path);
|
||||
res = install_copy_staging_root_files(staging, "sd:/");
|
||||
if (res != FR_OK)
|
||||
return res;
|
||||
|
||||
set_color(COLOR_GREEN);
|
||||
gfx_printf(" Kopie abgeschlossen!\n");
|
||||
|
||||
Reference in New Issue
Block a user