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

Add ability to edit editor feature profiles

Allows enabling/disabling parts of the editor and storing/loading profiles for that.
This commit is contained in:
Juan Linietsky
2019-04-08 19:18:03 -03:00
parent 9ab17b664d
commit a20235aeb0
24 changed files with 1586 additions and 67 deletions

View File

@@ -571,10 +571,16 @@ void FileAccess::store_buffer(const uint8_t *p_src, int p_length) {
store_8(p_src[i]);
}
Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path) {
Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path, Error *r_error) {
FileAccess *f = FileAccess::open(p_path, READ);
ERR_FAIL_COND_V(!f, Vector<uint8_t>());
FileAccess *f = FileAccess::open(p_path, READ, r_error);
if (!f) {
if (r_error) { // if error requested, do not throw error
return Vector<uint8_t>();
} else {
ERR_FAIL_COND_V(!f, Vector<uint8_t>());
}
}
Vector<uint8_t> data;
data.resize(f->get_len());
f->get_buffer(data.ptrw(), data.size());
@@ -582,6 +588,26 @@ Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path) {
return data;
}
String FileAccess::get_file_as_string(const String &p_path, Error *r_error) {
Error err;
Vector<uint8_t> array = get_file_as_array(p_path, &err);
if (r_error) {
*r_error = err;
}
if (err != OK) {
if (r_error) {
return String();
} else {
ERR_FAIL_COND_V(err != OK, String());
}
}
String ret;
ret.parse_utf8((const char *)array.ptr(), array.size());
return ret;
}
String FileAccess::get_md5(const String &p_file) {
FileAccess *f = FileAccess::open(p_file, READ);