Files
armorpaint/paint/sources/import_theme.c
T

19 lines
674 B
C
Raw Normal View History

2026-03-09 13:17:15 +01:00
#include "global.h"
2026-03-07 21:12:59 +01:00
void import_theme_run(char *path) {
2026-03-06 12:56:38 +01:00
if (!path_is_json(path)) {
console_error(strings_unknown_asset_format());
return;
}
2026-03-07 21:12:59 +01:00
char *filename = substring(path, string_last_index_of(path, PATH_SEP) + 1, string_length(path));
2026-03-10 21:00:00 +01:00
char *dst_path = string("%s%sthemes%s%s", path_data(), PATH_SEP, PATH_SEP, filename);
2026-03-06 12:56:38 +01:00
file_copy(path, dst_path); // Copy to preset folder
box_preferences_fetch_themes(); // Refresh file list
2026-04-21 10:52:27 +02:00
g_config->theme = string_copy(filename);
2026-03-06 12:56:38 +01:00
box_preferences_h_theme->i = box_preferences_get_theme_index();
2026-04-05 16:41:00 +02:00
config_load_theme(g_config->theme, true);
2026-03-15 11:37:45 +01:00
console_info(string("%s %s", tr("Theme imported:"), filename));
2026-03-06 12:56:38 +01:00
}