1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

Added File.get_path and File.get_path_absolute functions

This commit is contained in:
Marcelo Fernandez
2018-03-09 11:45:21 -03:00
parent b842369442
commit a4e64c5454
8 changed files with 70 additions and 5 deletions

View File

@@ -1535,6 +1535,17 @@ bool _File::is_open() const {
return f != NULL;
}
String _File::get_path() const {
ERR_FAIL_COND_V(!f, "");
return f->get_path();
}
String _File::get_path_absolute() const {
ERR_FAIL_COND_V(!f, "");
return f->get_path_absolute();
}
void _File::seek(int64_t p_position) {
@@ -1824,6 +1835,8 @@ void _File::_bind_methods() {
ClassDB::bind_method(D_METHOD("open", "path", "flags"), &_File::open);
ClassDB::bind_method(D_METHOD("close"), &_File::close);
ClassDB::bind_method(D_METHOD("get_path"), &_File::get_path);
ClassDB::bind_method(D_METHOD("get_path_absolute"), &_File::get_path_absolute);
ClassDB::bind_method(D_METHOD("is_open"), &_File::is_open);
ClassDB::bind_method(D_METHOD("seek", "position"), &_File::seek);
ClassDB::bind_method(D_METHOD("seek_end", "position"), &_File::seek_end, DEFVAL(0));