Rearrangement
This commit is contained in:
13
source/fs.c
13
source/fs.c
@@ -218,6 +218,12 @@ int folder_delete(const char *path) {
|
||||
} else {
|
||||
file_count++;
|
||||
log_write(" DEL: %s\n", fno.fname);
|
||||
|
||||
// Clear read-only attribute if set (common with some CFW packs)
|
||||
if (fno.fattrib & AM_RDO) {
|
||||
f_chmod(full_path, fno.fattrib & ~AM_RDO, AM_RDO);
|
||||
}
|
||||
|
||||
res = f_unlink(full_path);
|
||||
if (res != FR_OK) {
|
||||
log_write(" ERROR: %s\n", fs_error_str(res));
|
||||
@@ -232,6 +238,13 @@ int folder_delete(const char *path) {
|
||||
|
||||
if (res == FR_OK || res == FR_NO_FILE) {
|
||||
log_write(" Removing dir: %s (%d files, %d subdirs)\n", path, file_count, dir_count);
|
||||
|
||||
// Check and clear read-only attribute on directory if set
|
||||
FILINFO dir_info;
|
||||
if (f_stat(path, &dir_info) == FR_OK && (dir_info.fattrib & AM_RDO)) {
|
||||
f_chmod(path, dir_info.fattrib & ~AM_RDO, AM_RDO);
|
||||
}
|
||||
|
||||
res = f_unlink(path);
|
||||
if (res != FR_OK) {
|
||||
log_write(" ERROR rmdir: %s\n", fs_error_str(res));
|
||||
|
||||
Reference in New Issue
Block a user