0 votes

I was able to find the _File class under "core/bind/core_bind.h" and it seems to work for the most part but I don't know how to write Ref<File> file = File::_new();, which I found on a GDNative plugin, in its Module equivalent.

Godot version 3.5 beta custom build (working on a module in c++)
in Engine by (195 points)

1 Answer

0 votes

Oh I actually figured it out. Please correct me if I'm wrong. The call that made it work for me was the following:

Ref<_File>  file = Ref<_File>();
file.instance();
by (195 points)

You can simplify it to:

Ref<_File> file;
file.instance();

Although in reality, _File exists only because it is an object wrapper around the real thing. If you write a module, you dont have to use that. You could use the real thing instead:

FileAccessRef f = FileAccess::open(path, FileAccess::READ);

Gotcha! Thanks for your help.

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.