1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks

This commit is contained in:
Rémi Verschelde
2021-05-04 14:41:06 +02:00
parent 64a63e0861
commit b5e1e05ef2
1439 changed files with 1 additions and 34187 deletions

View File

@@ -36,9 +36,7 @@
#include "core/project_settings.h"
String DirAccess::_get_root_path() const {
switch (_access_type) {
case ACCESS_RESOURCES:
return ProjectSettings::get_singleton()->get_resource_path();
case ACCESS_USERDATA:
@@ -48,9 +46,7 @@ String DirAccess::_get_root_path() const {
}
}
String DirAccess::_get_root_string() const {
switch (_access_type) {
case ACCESS_RESOURCES:
return "res://";
case ACCESS_USERDATA:
@@ -61,7 +57,6 @@ String DirAccess::_get_root_string() const {
}
int DirAccess::get_current_drive() {
String path = get_current_dir().to_lower();
for (int i = 0; i < get_drive_count(); i++) {
String d = get_drive(i).to_lower();
@@ -73,26 +68,21 @@ int DirAccess::get_current_drive() {
}
bool DirAccess::drives_are_shortcuts() {
return false;
}
String DirAccess::get_current_dir_without_drive() {
return get_current_dir();
}
static Error _erase_recursive(DirAccess *da) {
List<String> dirs;
List<String> files;
da->list_dir_begin();
String n = da->get_next();
while (n != String()) {
if (n != "." && n != "..") {
if (da->current_is_dir())
dirs.push_back(n);
else
@@ -105,10 +95,8 @@ static Error _erase_recursive(DirAccess *da) {
da->list_dir_end();
for (List<String>::Element *E = dirs.front(); E; E = E->next()) {
Error err = da->change_dir(E->get());
if (err == OK) {
err = _erase_recursive(da);
if (err) {
da->change_dir("..");
@@ -128,7 +116,6 @@ static Error _erase_recursive(DirAccess *da) {
}
for (List<String>::Element *E = files.front(); E; E = E->next()) {
Error err = da->remove(da->get_current_dir().plus_file(E->get()));
if (err) {
return err;
@@ -139,12 +126,10 @@ static Error _erase_recursive(DirAccess *da) {
}
Error DirAccess::erase_contents_recursive() {
return _erase_recursive(this);
}
Error DirAccess::make_dir_recursive(String p_dir) {
if (p_dir.length() < 1) {
return OK;
};
@@ -183,7 +168,6 @@ Error DirAccess::make_dir_recursive(String p_dir) {
String curpath = base;
for (int i = 0; i < subdirs.size(); i++) {
curpath = curpath.plus_file(subdirs[i]);
Error err = make_dir(curpath);
if (err != OK && err != ERR_ALREADY_EXISTS) {
@@ -195,17 +179,12 @@ Error DirAccess::make_dir_recursive(String p_dir) {
}
String DirAccess::fix_path(String p_path) const {
switch (_access_type) {
case ACCESS_RESOURCES: {
if (ProjectSettings::get_singleton()) {
if (p_path.begins_with("res://")) {
String resource_path = ProjectSettings::get_singleton()->get_resource_path();
if (resource_path != "") {
return p_path.replace_first("res:/", resource_path);
};
return p_path.replace_first("res://", "");
@@ -214,12 +193,9 @@ String DirAccess::fix_path(String p_path) const {
} break;
case ACCESS_USERDATA: {
if (p_path.begins_with("user://")) {
String data_dir = OS::get_singleton()->get_user_data_dir();
if (data_dir != "") {
return p_path.replace_first("user:/", data_dir);
};
return p_path.replace_first("user://", "");
@@ -227,7 +203,6 @@ String DirAccess::fix_path(String p_path) const {
} break;
case ACCESS_FILESYSTEM: {
return p_path;
} break;
case ACCESS_MAX:
@@ -240,16 +215,12 @@ String DirAccess::fix_path(String p_path) const {
DirAccess::CreateFunc DirAccess::create_func[ACCESS_MAX] = { 0, 0, 0 };
DirAccess *DirAccess::create_for_path(const String &p_path) {
DirAccess *da = NULL;
if (p_path.begins_with("res://")) {
da = create(ACCESS_RESOURCES);
} else if (p_path.begins_with("user://")) {
da = create(ACCESS_USERDATA);
} else {
da = create(ACCESS_FILESYSTEM);
}
@@ -257,7 +228,6 @@ DirAccess *DirAccess::create_for_path(const String &p_path) {
}
DirAccess *DirAccess::open(const String &p_path, Error *r_error) {
DirAccess *da = create_for_path(p_path);
ERR_FAIL_COND_V_MSG(!da, NULL, "Cannot create DirAccess for path '" + p_path + "'.");
@@ -273,7 +243,6 @@ DirAccess *DirAccess::open(const String &p_path, Error *r_error) {
}
DirAccess *DirAccess::create(AccessType p_access) {
DirAccess *da = create_func[p_access] ? create_func[p_access]() : NULL;
if (da) {
da->_access_type = p_access;
@@ -283,7 +252,6 @@ DirAccess *DirAccess::create(AccessType p_access) {
};
String DirAccess::get_full_path(const String &p_path, AccessType p_access) {
DirAccess *d = DirAccess::create(p_access);
if (!d)
return p_path;
@@ -295,7 +263,6 @@ String DirAccess::get_full_path(const String &p_path, AccessType p_access) {
}
Error DirAccess::copy(String p_from, String p_to, int p_chmod_flags) {
//printf("copy %s -> %s\n",p_from.ascii().get_data(),p_to.ascii().get_data());
Error err;
FileAccess *fsrc = FileAccess::open(p_from, FileAccess::READ, &err);
@@ -307,7 +274,6 @@ Error DirAccess::copy(String p_from, String p_to, int p_chmod_flags) {
FileAccess *fdst = FileAccess::open(p_to, FileAccess::WRITE, &err);
if (err) {
fsrc->close();
memdelete(fsrc);
ERR_PRINTS("Failed to open " + p_to);
@@ -319,7 +285,6 @@ Error DirAccess::copy(String p_from, String p_to, int p_chmod_flags) {
fsrc->seek(0);
err = OK;
while (size--) {
if (fsrc->get_error() != OK) {
err = fsrc->get_error();
break;
@@ -371,9 +336,7 @@ Error DirAccess::_copy_dir(DirAccess *p_target_da, String p_to, int p_chmod_flag
list_dir_begin();
String n = get_next();
while (n != String()) {
if (n != "." && n != "..") {
if (current_is_dir())
dirs.push_back(n);
else {
@@ -444,7 +407,6 @@ Error DirAccess::copy_dir(String p_from, String p_to, int p_chmod_flags) {
}
bool DirAccess::exists(String p_dir) {
DirAccess *da = DirAccess::create_for_path(p_dir);
bool valid = da->change_dir(p_dir) == OK;
memdelete(da);
@@ -452,7 +414,6 @@ bool DirAccess::exists(String p_dir) {
}
DirAccess::DirAccess() {
_access_type = ACCESS_FILESYSTEM;
}