Files
armorpaint/Sources/arm/io/ImportKeymap.hx
T
2021-10-13 08:34:24 +02:00

22 lines
613 B
Haxe

package arm.io;
import arm.sys.Path;
import arm.sys.File;
class ImportKeymap {
public static function run(path: String) {
if (!Path.isJson(path)) {
Console.error(Strings.error1());
return;
}
var filename = path.substr(path.lastIndexOf(Path.sep) + 1);
var dstPath = Path.data() + Path.sep + "keymap_presets" + Path.sep + filename;
File.copy(path, dstPath); // Copy to preset folder
arm.ui.BoxPreferences.fetchKeymaps(); // Refresh file list
arm.ui.BoxPreferences.presetHandle.position = arm.ui.BoxPreferences.getPresetIndex();
Console.info(tr("Keymap imported:") + " " + filename);
}
}