0 votes

I have a project that downloads an executable file from my server, and it needs to execute it. It won't start, probably because it doesn't have executable permissions, but how do I give the file these permissions from gdscript?

OS is Linux, Godot 3.2.3

Godot version 3.2.3
in Engine by (612 points)

1 Answer

0 votes
Best answer

Hi,

Maybe with the OS.execute method.

OS.execute

I've not tried it as I'm running Windows atm, but looks like it should work. You can chmod the file if you have permission to do so.

Something like:

var output = []
var exit_code = OS.execute("chmod", ["+x", "./filetochmod"], true, output)

I've just tested this on Ubuntu 20.04 and this worked:

OS.execute("chmod", ["+x", "/tmp/d.sh"], true)
by (1,817 points)
selected by

I figured it out only minutes before this answer lol, and this is exactly what worked!

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.