2026-03-09 13:17:15 +01:00
|
|
|
|
|
|
|
|
#include "global.h"
|
|
|
|
|
|
2026-03-07 21:12:59 +01:00
|
|
|
void import_keymap_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%skeymap_presets%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_keymaps(); // Refresh file list
|
|
|
|
|
box_preferences_h_preset->i = box_preferences_get_preset_index();
|
2026-03-15 11:37:45 +01:00
|
|
|
console_info(string("%s %s", tr("Keymap imported:"), filename));
|
2026-03-06 12:56:38 +01:00
|
|
|
}
|