Move pack files instead of copying; one file-op core for all modes
Install: staging and sd:/ are on the same card, so pack folders are now moved with f_rename (a missing target folder moves in one step, existing ones are merged file by file). Copying is only a per-entry fallback. The staging cleanup afterwards only removes empty folders. Deletion: one f_stat per list entry, no full recursive count before deleting; large folders are detected with a probe that stops after 51 entries. Progress lines count processed entries instead of needing an extra pass for a total. Six copy/delete walkers (fs.c + install.c) are replaced by fs_delete_tree, fs_move_tree and fs_move_file sharing one path buffer and one copy buffer per run; the 'alternative copy method' retry is gone. extras/hekate-ams-pro is moved too. Backups keep copy semantics.
This commit is contained in:
1 parent
c033b988ca
commit
664216fa11
6 files changed
+453
-784
No files matched your search
+19
-3
@@ -6,15 +6,31 @@
|
||||
#pragma once
|
||||
#include <utils/types.h>
|
||||
|
||||
#define FS_PATH_MAX 512
|
||||
|
||||
// Called once per processed entry (file or folder) by the tree walkers.
|
||||
typedef void (*fs_progress_cb)(void *ctx);
|
||||
|
||||
// Error code to string
|
||||
const char *fs_error_str(int err);
|
||||
|
||||
// File/folder operations - returns 0 on success
|
||||
// File/folder operations - return FR_OK (0) on success
|
||||
int file_copy(const char *src, const char *dst);
|
||||
int folder_copy(const char *src, const char *dst);
|
||||
int folder_copy(const char *src_dir, const char *dst_parent); // copies into dst_parent/<name>
|
||||
int folder_delete(const char *path);
|
||||
|
||||
// File logging
|
||||
// Delete a file or folder tree (missing path = FR_OK).
|
||||
int fs_delete_tree(const char *path, fs_progress_cb cb, void *ctx);
|
||||
// Move a file, replacing dst (rename, copy as fallback).
|
||||
int fs_move_file(const char *src, const char *dst);
|
||||
// Move folder src_dir into dst_parent/<name>, merging into an existing folder.
|
||||
int fs_move_tree(const char *src_dir, const char *dst_parent, fs_progress_cb cb, void *ctx);
|
||||
// Count entries below path; stops at limit (0 = count everything).
|
||||
u32 fs_count_items(const char *path, u32 limit);
|
||||
// Free the shared copy buffer.
|
||||
void fs_release_buffers(void);
|
||||
|
||||
// File logging (enabled via debug.ini log=1)
|
||||
void log_init(const char *path);
|
||||
void log_close(void);
|
||||
void log_write(const char *fmt, ...);
|
||||
|
||||
Reference in new issue
Block a user