summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-06-21 16:34:18 +0200
committerGitHub <noreply@github.com>2016-06-21 16:34:18 +0200
commit81a5e4238d43891442556c5ed208a15ee938b2cd (patch)
tree3faaf73f9dde2a281693e5dcfff1b1b908887549 /core
parentae855438069e16a0da6d569404cff11f9c8c7bd6 (diff)
parent0f20d8756e6d6842449e4249ba961178b24c72ee (diff)
Merge pull request #5325 from vnen/doc-file
Add class reference for File class
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index bc08c64d05..ace7e7c7b7 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -1566,7 +1566,12 @@ DVector<uint8_t> _File::get_buffer(int p_length) const{
String _File::get_as_text() const {
+ ERR_FAIL_COND_V(!f, String());
+
String text;
+ size_t original_pos = f->get_pos();
+ f->seek(0);
+
String l = get_line();
while(!eof_reached()) {
text+=l+"\n";
@@ -1574,6 +1579,8 @@ String _File::get_as_text() const {
}
text+=l;
+ f->seek(original_pos);
+
return text;