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

Added File.get_path and File.get_path_absolute functions

(cherry picked from commit a4e64c5454)
This commit is contained in:
Marcelo Fernandez
2018-03-09 11:45:21 -03:00
committed by Hein-Pieter van Braam
parent 41f360f9c2
commit 272fb05270
8 changed files with 70 additions and 5 deletions

View File

@@ -1519,6 +1519,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) {
@@ -1808,6 +1819,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));