diff options
author | Hein-Pieter van Braam <hp@tmm.cx> | 2018-03-15 22:21:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-15 22:21:21 +0100 |
commit | 9bc0503c9174309dcdaf116ae16ccd9e4d9bce20 (patch) | |
tree | b8b541f778686bf333a802617e2bd37ad41916b9 /core/bind/core_bind.cpp | |
parent | f8706cbdf2133744174490c4f27eca0ebd3a6480 (diff) | |
parent | a4e64c545406be00c00fe93818994977ae378fb9 (diff) |
Merge pull request #17376 from marcelofg55/file_get_path
Added File.get_path and File.get_path_absolute functions
Diffstat (limited to 'core/bind/core_bind.cpp')
-rw-r--r-- | core/bind/core_bind.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index a81301e8ea..20adf7ff02 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -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)); |