import_theme.ts 605 B

12345678910111213141516
  1. function import_theme_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 + "themes" + path_sep + filename;
  8. file_copy(path, dst_path); // Copy to preset folder
  9. box_preferences_fetch_themes(); // Refresh file list
  10. config_raw.theme = filename;
  11. box_preferences_theme_handle.position = box_preferences_get_theme_index();
  12. config_load_theme(config_raw.theme);
  13. console_info(tr("Theme imported:") + " " + filename);
  14. }