Created
July 12, 2018 19:07
-
-
Save Yanrishatum/bec89c12982a4e438f874fa8f044b4d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var what = requestArgument("Haxe or Hashlink? [HAXE/hl]: "); | |
if (what.toLowerCase() != "hl") what = "haxe"; | |
else what = "hl"; | |
var currFile = "haxe_ver/." + what + "_current"; | |
var dir = sys.FileSystem.readDirectory("haxe_ver"); | |
var current = sys.FileSystem.exists(currFile) ? sys.io.File.getContent(currFile) : ""; | |
var versions = []; | |
for (name in dir) | |
{ | |
if (name.charAt(0) == ".") continue; | |
if (StringTools.startsWith(name, what)) | |
{ | |
var idx = versions.push(name); | |
if (name == current) name = "[" + name + "]"; | |
Sys.println(idx + ": " + name); | |
} | |
} | |
Sys.print("Select version: "); | |
var char = Sys.stdin().readLine(); | |
if (char != "") | |
{ | |
char = Std.parseInt(char) - 1; | |
if (char >= 0 && char < versions.length) | |
{ | |
Sys.println("Setting new version to: " + versions[char]); | |
if (sys.FileSystem.exists(what)) Sys.command("rm", [what]); | |
Sys.command("mklink", ["/d", what, "haxe_ver\\" + versions[char]]); | |
sys.io.File.saveContent(currFile, versions[char]); | |
} | |
else Sys.println("Invalid index!"); | |
} | |
else Sys.println("No changes were made"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment