Alright. I was trying to see if I could use an HTTP Request to download an exe file and an x86_64 file from GitHub. I've tried many was to succeed in it, but it never prospered. this is an example of what I tried to do.
What this is supposed to do its download the file & put it into the apps directory of my app.
func DownloadTestApp(result, response_code, headers, body):
print(body)
print(result)
print(response_code)
print(headers)
if (current_app.file_exists("user://apps/TestApp.exe")):
OS.alert("File Exists", "Error")
http_request.cancel_request()
else:
var f = File.new()
f.open("user://apps/TestApp.exe", File.WRITE)
f.store_buffer(body)
f.close()
http_request.cancel_request()
pass
What this is supposed to do is find what button I pressed in a Menu Button & do what it needs to do to start the download.
func _item_pressed(id):
var user_path = OS.get_user_data_dir()
var item_name = $DownloadPrograms.get_popup().get_item_text(id)
if item_name == "TestApp":
OS.alert("The software will now continue to download TestApp", "Download")
http_request.connect("request_completed", self, "DownloadTestApp")
http_request.request("https://github.com/Blockyheadman/TestApp/blob/main/apps/TestApp.exe?raw=true")
http_request.set_download_file(user_path+"/"+"apps"+"/"+"TestApp.exe")
Please note that the url that's included isn't real. It's the same thing as my personal url but some names are changed