0 votes

I am trying to make a launcher for multiple games (running on linux, more specifically Ubuntu.) Trying to open the game file with OS.shell_open(path) or OS.execute(path, args) does not work. The code i am using is as follows:

var PATH = dirs[index].replace("user://", OS.get_user_data_dir()) + "/" + data.binary
        print(PATH)
        OS.execute(PATH, PoolStringArray([]))
        get_tree().quit()

I have checked the path, and it is correct. Is this possible, and if so, what am I doing wrong?

Godot version 3.2.3
in Engine by (153 points)

1 Answer

+1 vote
Best answer
var PATH = dirs[index].replace("user://", OS.get_user_data_dir()) + "/" + data.binary
print(PATH)
OS.execute(PATH, [], false)
yield(get_tree().create_timer(1.0), "timeout")
get_tree().quit()
by (4,972 points)
selected by

This gets closer, but still nothing is opening. OS.execute() is returning 2043, if that matters at all. Does it matter if PATH has spaces (they are prefixed by a \ like i am executing it from command line.)

Did some experimentation, removing the spaces from the name ended up working.

Dang you beat me to it
That number is the Process iD in case you wanted to do more stuff with it

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.