This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

I am curious to know what does the function open() in File returns. I know it is an integer, but of what? My guess is for error checking, but then, why not return Error instead?

in Engine by (60 points)

1 Answer

+1 vote
Best answer

Should be an Error which is an enumerated type. You can see in the code below it will return parameters invalid, can't open file, and OK.

https://github.com/godotengine/godot/blob/df61dc4b2bd54a5a40c515493c76f5a458e5b541/drivers/windows/file_access_windows.cpp#L56

The enum can be seen here:

https://github.com/godotengine/godot/blob/df61dc4b2bd54a5a40c515493c76f5a458e5b541/core/error_list.h#L40

by (5,286 points)
selected by
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 Frequently asked questions and 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 [email protected] with your username.