Launcher/Versions.gd

39 lines
873 B
GDScript

extends Node
var versions_dir_path = OS.get_config_dir()+"/UltraFlare/versions"
var versions_dir = Directory.new()
var executable = File.new()
var os_name = ""
var suffix = ""
func get_versions():
var versions = []
versions_dir.open(versions_dir_path)
versions_dir.list_dir_begin(true)
var file_name = versions_dir.get_next()
while file_name != "":
if executable.file_exists(versions_dir_path+"/"+file_name+"/UltraFlare-"+os_name+"-x86_64"+suffix):
versions.append(file_name)
file_name = versions_dir.get_next()
versions_dir.list_dir_end()
#versions.sort()
return versions
func _ready():
if OS.get_name() == "X11":
os_name = "linux"
elif OS.get_name() == "Windows":
os_name = "windows"
if os_name == "windows":
suffix = ".exe"
if not versions_dir.dir_exists(versions_dir_path):
versions_dir.make_dir_recursive(versions_dir_path)