0 votes

I have the following code:

var dir = Directory.new()
var err = dir.change_dir("../")
print( "Err: " + str(err) )

And the output looks like:
Err:31
I looked at http://docs.godotengine.org/en/stable/classes/class_@global%20scope.html#class-global-scope and 31 is for ERRINVALIDPARAMETER.

Late edit: I'm using godot 2.1.3 stable on win 64

Best regards,
Radu

in Engine by (104 points)
edited by

1 Answer

0 votes

Look line I needed to open a directory first.
The following code works fine:

print( "Data dir: " + OS.get_data_dir() )
dir.open(OS.get_data_dir())
err = dir.change_dir("../")
print( "Err: " + str(err) )
print( "Data dir: " + dir.get_current_dir() )
by (104 points)
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.