How to open an exe file that is located in res:\\.import\rp\easyrp.exe on startup of game

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

How would I open an exe file called easyrp.exe on startup of my game? I put

var array = []
var args = PoolStringArray(array)
OS.execute("res:\\.import\rp\easyrp.exe", args, false)

but it didnt work. It makes discord rich presence seperate app open as i cannot get godot rich presence to work.


:bust_in_silhouette: Reply From: JimArtificer

Try moving the executable to a different directory. Place it in the root of res: if possible.

As noted in the docs, platform path resolution is used. Since different operating systems use different path separators that may be the root of your issue.

Alternatively, you may be inadvertently escaping characters you didn’t intend to. For example, \\ vs. \ as a path separator. Or res:\\\\.import\\rp\\easyrp.exe in your case.

:bust_in_silhouette: Reply From: bruvzg

If you have exported your game, it’s impossible to directly run executable that is inside PCK or ZIP archive (this is OS limitation).

You will need to extract it first (open your file from the res:// path and save it to the user://easyrp.exe for example) or you can add your executable manually (to the same folder where main EXE and PCK are) after exporting the project and use its full path: OS.get_executable_path().get_base_dir().plus_file("easyrp.exe").

Note: If your executable depends on some other exported files, you’ll need to extract them as well, since only Godot will be able to access them from the PCK.