mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
Make FileAccess and DirAccess classes reference counted.
This commit is contained in:
parent
ca9372622f
commit
9381acb6a4
193 changed files with 1122 additions and 1776 deletions
|
|
@ -167,15 +167,13 @@ String escape_csharp_keyword(const String &p_name) {
|
|||
Error read_all_file_utf8(const String &p_path, String &r_content) {
|
||||
Vector<uint8_t> sourcef;
|
||||
Error err;
|
||||
FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
|
||||
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ, &err);
|
||||
ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot open file '" + p_path + "'.");
|
||||
|
||||
uint64_t len = f->get_length();
|
||||
sourcef.resize(len + 1);
|
||||
uint8_t *w = sourcef.ptrw();
|
||||
uint64_t r = f->get_buffer(w, len);
|
||||
f->close();
|
||||
memdelete(f);
|
||||
ERR_FAIL_COND_V(r != len, ERR_CANT_OPEN);
|
||||
w[len] = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue