De-duplicate variable definitions
This commit is contained in:
parent
aaea8a0e3f
commit
989742955b
27
Main_menu.gd
27
Main_menu.gd
@ -23,6 +23,12 @@ func _ready():
|
|||||||
elif OS.get_name() == "Windows":
|
elif OS.get_name() == "Windows":
|
||||||
os_name = "windows"
|
os_name = "windows"
|
||||||
|
|
||||||
|
if os_name == "windows":
|
||||||
|
suffix = ".exe"
|
||||||
|
else:
|
||||||
|
suffix = ""
|
||||||
|
|
||||||
|
|
||||||
var versions_request = HTTPRequest.new()
|
var versions_request = HTTPRequest.new()
|
||||||
add_child(versions_request)
|
add_child(versions_request)
|
||||||
|
|
||||||
@ -37,17 +43,6 @@ func _versions_request_completed(result, response_code, headers, body):
|
|||||||
print("Got versions!")
|
print("Got versions!")
|
||||||
|
|
||||||
func _download_request_completed(result, response_code, headers, body):
|
func _download_request_completed(result, response_code, headers, body):
|
||||||
if OS.get_name() == "X11":
|
|
||||||
var os_name = "linux"
|
|
||||||
elif OS.get_name() == "Windows":
|
|
||||||
var os_name = "windows"
|
|
||||||
|
|
||||||
if os_name == "windows":
|
|
||||||
var suffix = ".exe"
|
|
||||||
else:
|
|
||||||
var suffix = ""
|
|
||||||
|
|
||||||
print("Download complete")
|
|
||||||
var dl_file = File.new()
|
var dl_file = File.new()
|
||||||
dl_file.open(OS.get_config_dir()+"/UltraFlare/current/UltraFlare-"+os_name+"-x86_64", 7)
|
dl_file.open(OS.get_config_dir()+"/UltraFlare/current/UltraFlare-"+os_name+"-x86_64", 7)
|
||||||
dl_file.store_buffer(body)
|
dl_file.store_buffer(body)
|
||||||
@ -60,20 +55,14 @@ func _download_request_completed(result, response_code, headers, body):
|
|||||||
OS.execute("chmod", ["+x", OS.get_config_dir()+"/UltraFlare/current/UltraFlare-"+os_name+"-x86_64"])
|
OS.execute("chmod", ["+x", OS.get_config_dir()+"/UltraFlare/current/UltraFlare-"+os_name+"-x86_64"])
|
||||||
|
|
||||||
func _on_Play_button_pressed():
|
func _on_Play_button_pressed():
|
||||||
var suffix = ""
|
|
||||||
if os_name == "windows":
|
|
||||||
suffix = ".exe"
|
|
||||||
|
|
||||||
print(os_name)
|
|
||||||
|
|
||||||
if not newest_local_version or newest_version > newest_local_version:
|
if not newest_local_version or newest_version > newest_local_version:
|
||||||
var download = HTTPRequest.new()
|
var download = HTTPRequest.new()
|
||||||
|
var url
|
||||||
|
|
||||||
add_child(download)
|
add_child(download)
|
||||||
|
|
||||||
download.connect("request_completed", self, "_download_request_completed")
|
download.connect("request_completed", self, "_download_request_completed")
|
||||||
|
|
||||||
var url
|
|
||||||
|
|
||||||
for asset in newest_version_data.assets:
|
for asset in newest_version_data.assets:
|
||||||
if asset.name == "UltraFlare-"+os_name+"-x86_64"+suffix:
|
if asset.name == "UltraFlare-"+os_name+"-x86_64"+suffix:
|
||||||
url = asset.browser_download_url
|
url = asset.browser_download_url
|
||||||
|
Loading…
Reference in New Issue
Block a user