How to download files from the internet and save on the project folder? (portuguese language)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By tautologias345
func _on_Button_pressed():
if !$AudioStreamPlayer.is_playing():
	var file2check = File.new()
	var doFileExists = file2check.file_exists("res://musics/aca" + $LineEdit.get_text() + ".mp3")
	if !doFileExists:
		$HTTPRequest.set_download_file("res://musics/aca" + $LineEdit.get_text() + ".mp3")
		$HTTPRequest.request("https://www.eduardodequadros.online/playlist_academia/aca" + $LineEdit.get_text() + ".mp3")
	else:
		$AudioStreamPlayer.stream = load("res://musics/aca" + $LineEdit.get_text() + ".mp3")
		$AudioStreamPlayer.stream.loop = false
		$AudioStreamPlayer.play()

func _on_LineEdit_gui_input(event):
if event is InputEventKey && event.is_pressed() && !$AudioStreamPlayer.is_playing():
	if event.get_scancode() == KEY_UP:
		if numero_musica >= 72:
			numero_musica = 72
			if numero_musica < 10:
				$LineEdit.set_text("00" + str(numero_musica))
			elif numero_musica < 100:
				$LineEdit.set_text("0" + str(numero_musica))
			else:
				$LineEdit.set_text(str(numero_musica))
		else:
			numero_musica += 1
			if numero_musica < 10:
				$LineEdit.set_text("00" + str(numero_musica))
			elif numero_musica < 100:
				$LineEdit.set_text("0" + str(numero_musica))
			else:
				$LineEdit.set_text(str(numero_musica))
	elif event.get_scancode() == KEY_DOWN:
		if numero_musica <= 1:
			numero_musica = 1
			if numero_musica < 10:
				$LineEdit.set_text("00" + str(numero_musica))
			elif numero_musica < 100:
				$LineEdit.set_text("0" + str(numero_musica))
			else:
				$LineEdit.set_text(str(numero_musica))
		else:
			numero_musica -= 1
			if numero_musica < 10:
				$LineEdit.set_text("00" + str(numero_musica))
			elif numero_musica < 100:
				$LineEdit.set_text("0" + str(numero_musica))
			else:
				$LineEdit.set_text(str(numero_musica))

This manner, when I press the button on UI for the first time on the debugging program, click on Godot editor, the file is downloaded, but when just using the exported program, the file isn’t downloaded. I want to create a Windows program installer with Inno Setup, that doesn’t accept setups larger than 2 GB.

:bust_in_silhouette: Reply From: andersmmg

You can’t change the files in res:// with a built project. The res:// folder is not meant to be changed at runtime, only read from. For that you’ll want to use the user:// directory instead, which will be in a separate folder on the system for game data. This is also where save files are usually stored as well. :wink:

:bust_in_silhouette: Reply From: tautologias345

andersmmg, you said me that I need a user:// path. I want to know if can be a relative path. For example, if my script is on res:// path, the relative path to download will be ./musics/aca01.mp3.