Start removing CFG_PATH() / .config, add MNT_PATH() macro

This commit is contained in:
Willy-JL
2024-08-07 02:35:09 +02:00
parent bcf37a1bd4
commit 1b2d173d63
7 changed files with 16 additions and 20 deletions

View File

@@ -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;

View File

@@ -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"

View File

@@ -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);
}
}

View File

@@ -13,7 +13,7 @@
#include <toolbox/tar/tar_archive.h>
#include <toolbox/crc32_calc.h>
#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) {

View File

@@ -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

View File

@@ -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];

View File

@@ -5,7 +5,7 @@
#include <stdint.h>
#include <toolbox/colors.h>
#define MOMENTUM_SETTINGS_PATH CFG_PATH("momentum_settings.txt")
#define MOMENTUM_SETTINGS_PATH INT_PATH(".momentum_settings.txt")
#define ASSET_PACKS_NAME_LEN 32