Files
armorpaint/Sources/arm/io/ImportKeymap.hx
T

22 lines
601 B
Haxe
Raw Normal View History

2020-01-10 16:30:02 +01:00
package arm.io;
import arm.sys.Path;
import arm.sys.File;
class ImportKeymap {
public static function run(path: String) {
if (!Path.isJson(path)) {
Log.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();
Log.info("Keymap '" + filename + "' imported.");
}
}