import_keymap.ts 550 B

1234567891011121314
  1. function import_keymap_run(path: string) {
  2. if (!path_is_json(path)) {
  3. console_error(strings_error1());
  4. return;
  5. }
  6. let filename: string = substring(path, string_last_index_of(path, path_sep) + 1, path.length);
  7. let dst_path: string = path_data() + path_sep + "keymap_presets" + path_sep + filename;
  8. file_copy(path, dst_path); // Copy to preset folder
  9. box_preferences_fetch_keymaps(); // Refresh file list
  10. box_preferences_preset_handle.position = box_preferences_get_preset_index();
  11. console_info(tr("Keymap imported:") + " " + filename);
  12. }