Files
armorpaint/base/Sources/ImportTheme.ts
T
luboslenco ee67b50c0f Use ts
2024-01-17 18:53:31 +01:00

20 lines
579 B
TypeScript

class ImportTheme {
static run = (path: string) => {
if (!Path.isJson(path)) {
Console.error(Strings.error1());
return;
}
let filename = path.substr(path.lastIndexOf(Path.sep) + 1);
let dstPath = Path.data() + Path.sep + "themes" + Path.sep + filename;
File.copy(path, dstPath); // Copy to preset folder
BoxPreferences.fetchThemes(); // Refresh file list
Config.raw.theme = filename;
BoxPreferences.themeHandle.position = BoxPreferences.getThemeIndex();
Config.loadTheme(Config.raw.theme);
Console.info(tr("Theme imported:") + " " + filename);
}
}