From 1b2d173d6396661d0461b8bc2d3ecd007d856154 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Wed, 7 Aug 2024 02:35:09 +0200 Subject: [PATCH] Start removing CFG_PATH() / .config, add MNT_PATH() macro --- applications/services/loader/loader_menu.h | 2 +- applications/services/storage/storage.h | 5 ++--- applications/services/storage/storage_processing.c | 7 ------- .../system/updater/util/update_task_worker_backup.c | 8 ++++++-- furi/flipper.c | 10 +++++----- lib/drivers/rgb_backlight.c | 2 +- lib/momentum/settings.h | 2 +- 7 files changed, 16 insertions(+), 20 deletions(-) diff --git a/applications/services/loader/loader_menu.h b/applications/services/loader/loader_menu.h index cd0f311a7..28059bf4f 100644 --- a/applications/services/loader/loader_menu.h +++ b/applications/services/loader/loader_menu.h @@ -5,7 +5,7 @@ extern "C" { #endif -#define MAINMENU_APPS_PATH CFG_PATH("mainmenu_apps.txt") +#define MAINMENU_APPS_PATH INT_PATH(".mainmenu_apps.txt") typedef struct LoaderMenu LoaderMenu; diff --git a/applications/services/storage/storage.h b/applications/services/storage/storage.h index e3d5d8a04..4af3458d8 100644 --- a/applications/services/storage/storage.h +++ b/applications/services/storage/storage.h @@ -14,18 +14,17 @@ extern "C" { #define STORAGE_INT_PATH_PREFIX "/int" #define STORAGE_EXT_PATH_PREFIX "/ext" -#define STORAGE_MNT_PATH_PREFIX "/mnt" #define STORAGE_ANY_PATH_PREFIX "/any" +#define STORAGE_MNT_PATH_PREFIX "/mnt" #define STORAGE_APP_DATA_PATH_PREFIX "/data" #define STORAGE_APP_ASSETS_PATH_PREFIX "/assets" -#define STORAGE_CFG_PATH_PREFIX STORAGE_EXT_PATH_PREFIX "/.config" #define INT_PATH(path) STORAGE_INT_PATH_PREFIX "/" path #define EXT_PATH(path) STORAGE_EXT_PATH_PREFIX "/" path #define ANY_PATH(path) STORAGE_ANY_PATH_PREFIX "/" path +#define MNT_PATH(path) STORAGE_MNT_PATH_PREFIX "/" path #define APP_DATA_PATH(path) STORAGE_APP_DATA_PATH_PREFIX "/" path #define APP_ASSETS_PATH(path) STORAGE_APP_ASSETS_PATH_PREFIX "/" path -#define CFG_PATH(path) STORAGE_CFG_PATH_PREFIX "/" path #define RECORD_STORAGE "storage" diff --git a/applications/services/storage/storage_processing.c b/applications/services/storage/storage_processing.c index 1c69ee29a..f5adbd8c2 100644 --- a/applications/services/storage/storage_processing.c +++ b/applications/services/storage/storage_processing.c @@ -611,13 +611,6 @@ void storage_process_alias( storage_process_common_mkdir(app, int_on_ext_path); } furi_string_free(int_on_ext_path); - } else if(furi_string_start_with(path, STORAGE_CFG_PATH_PREFIX)) { - // Create config folder if it doesn't exist - FuriString* config_path = furi_string_alloc_set(STORAGE_CFG_PATH_PREFIX); - if(create_folders && storage_process_common_stat(app, config_path, NULL) != FSE_OK) { - storage_process_common_mkdir(app, config_path); - } - furi_string_free(config_path); } } diff --git a/applications/system/updater/util/update_task_worker_backup.c b/applications/system/updater/util/update_task_worker_backup.c index 5a69f4654..bcf1fd141 100644 --- a/applications/system/updater/util/update_task_worker_backup.c +++ b/applications/system/updater/util/update_task_worker_backup.c @@ -13,7 +13,7 @@ #include #include -#define FIRSTBOOT_FLAG_PATH CFG_PATH("momentum_firstboot.flag") +#define FIRSTBOOT_FLAG_PATH INT_PATH(".momentum_firstboot.flag") #define TAG "UpdWorkerBackup" @@ -173,7 +173,11 @@ static bool update_task_post_update(UpdateTask* update_task) { tmp_path = furi_string_alloc_set(update_task->update_path); storage_common_rename( update_task->storage, - CFG_PATH("firstboot.flag"), // Poor naming, shouldn't be generic for all FW + EXT_PATH(".config/firstboot.flag"), // Poor naming, shouldn't be generic for all FW + FIRSTBOOT_FLAG_PATH); + storage_common_rename( + update_task->storage, + EXT_PATH(".config/momentum_firstboot.flag"), // Migrate to int on ext FIRSTBOOT_FLAG_PATH); if(storage_common_stat(update_task->storage, FIRSTBOOT_FLAG_PATH, NULL) == FSE_NOT_EXIST) { diff --git a/furi/flipper.c b/furi/flipper.c index e5979ffd8..2a0194679 100644 --- a/furi/flipper.c +++ b/furi/flipper.c @@ -64,10 +64,10 @@ void flipper_migrate_files() { bool delete; } renames[] = { // Renames on ext - {CFG_PATH("favorites.txt"), ARCHIVE_FAV_PATH, true}, // Adapt to OFW/UL - {CFG_PATH(".desktop.keybinds"), DESKTOP_KEYBINDS_PATH, true}, // Old naming - {CFG_PATH("xtreme_menu.txt"), MAINMENU_APPS_PATH, false}, // Keep both - {CFG_PATH("xtreme_settings.txt"), MOMENTUM_SETTINGS_PATH, false}, // Keep both + {EXT_PATH(".config/favorites.txt"), ARCHIVE_FAV_PATH, true}, // Adapt to OFW/UL + {EXT_PATH(".config/.desktop.keybinds"), DESKTOP_KEYBINDS_PATH, true}, // Old naming + {EXT_PATH(".config/xtreme_menu.txt"), MAINMENU_APPS_PATH, false}, // Keep both + {EXT_PATH(".config/xtreme_settings.txt"), MOMENTUM_SETTINGS_PATH, false}, // Keep both // Int -> Ext {INT_PATH(".bt.settings"), BT_SETTINGS_PATH, true}, {INT_PATH(".dolphin.state"), DOLPHIN_STATE_PATH, true}, @@ -77,7 +77,7 @@ void flipper_migrate_files() { {INT_PATH(".notification.settings"), NOTIFICATION_SETTINGS_PATH, true}, {INT_PATH(".infrared.settings"), INFRARED_SETTINGS_PATH, true}, // Ext -> Int - {CFG_PATH("desktop.settings"), DESKTOP_SETTINGS_PATH, true}, + {EXT_PATH(".config/desktop.settings"), DESKTOP_SETTINGS_PATH, true}, }; for(size_t i = 0; i < COUNT_OF(renames); ++i) { // Use copy+remove to not overwrite dst but still delete src diff --git a/lib/drivers/rgb_backlight.c b/lib/drivers/rgb_backlight.c index 1995c0d17..715fdfc07 100644 --- a/lib/drivers/rgb_backlight.c +++ b/lib/drivers/rgb_backlight.c @@ -24,7 +24,7 @@ #define RGB_BACKLIGHT_SETTINGS_MAGIC 0x15 #define RGB_BACKLIGHT_SETTINGS_VERSION 6 -#define RGB_BACKLIGHT_SETTINGS_PATH CFG_PATH("rgb_backlight.settings") +#define RGB_BACKLIGHT_SETTINGS_PATH INT_PATH(".rgb_backlight.settings") static struct { RgbColor colors[SK6805_LED_COUNT]; diff --git a/lib/momentum/settings.h b/lib/momentum/settings.h index 4d46700c1..2f8e22d96 100644 --- a/lib/momentum/settings.h +++ b/lib/momentum/settings.h @@ -5,7 +5,7 @@ #include #include -#define MOMENTUM_SETTINGS_PATH CFG_PATH("momentum_settings.txt") +#define MOMENTUM_SETTINGS_PATH INT_PATH(".momentum_settings.txt") #define ASSET_PACKS_NAME_LEN 32