Download Exe & x86_64 from GitHub

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Blockyheadman

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

This site is about questions. What is your one?

sash-rc | 2022-03-07 08:15

how to download a file from GitHub. Like I stated before, I tried many different ways to complete that, but it never really worked.

Blockyheadman | 2022-03-08 01:50