mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added later on if needed and ported.
This commit is contained in:
parent
f5b9cbaff6
commit
b8b4580448
137 changed files with 847 additions and 1269 deletions
|
@ -29,6 +29,7 @@
|
|||
/*************************************************************************/
|
||||
|
||||
#include "dir_access_jandroid.h"
|
||||
|
||||
#include "core/string/print_string.h"
|
||||
#include "file_access_android.h"
|
||||
#include "string_android.h"
|
||||
|
@ -51,8 +52,9 @@ Error DirAccessJAndroid::list_dir_begin() {
|
|||
|
||||
jstring js = env->NewStringUTF(current_dir.utf8().get_data());
|
||||
int res = env->CallIntMethod(io, _dir_open, js);
|
||||
if (res <= 0)
|
||||
if (res <= 0) {
|
||||
return ERR_CANT_OPEN;
|
||||
}
|
||||
|
||||
id = res;
|
||||
|
||||
|
@ -64,8 +66,9 @@ String DirAccessJAndroid::get_next() {
|
|||
|
||||
JNIEnv *env = get_jni_env();
|
||||
jstring str = (jstring)env->CallObjectMethod(io, _dir_next, id);
|
||||
if (!str)
|
||||
if (!str) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String ret = jstring_to_string((jstring)str, env);
|
||||
env->DeleteLocalRef((jobject)str);
|
||||
|
@ -83,8 +86,9 @@ bool DirAccessJAndroid::current_is_hidden() const {
|
|||
}
|
||||
|
||||
void DirAccessJAndroid::list_dir_end() {
|
||||
if (id == 0)
|
||||
if (id == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
JNIEnv *env = get_jni_env();
|
||||
env->CallVoidMethod(io, _dir_close, id);
|
||||
|
@ -102,22 +106,25 @@ String DirAccessJAndroid::get_drive(int p_drive) {
|
|||
Error DirAccessJAndroid::change_dir(String p_dir) {
|
||||
JNIEnv *env = get_jni_env();
|
||||
|
||||
if (p_dir.is_empty() || p_dir == "." || (p_dir == ".." && current_dir.is_empty()))
|
||||
if (p_dir.is_empty() || p_dir == "." || (p_dir == ".." && current_dir.is_empty())) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
String new_dir;
|
||||
|
||||
if (p_dir != "res://" && p_dir.length() > 1 && p_dir.ends_with("/"))
|
||||
if (p_dir != "res://" && p_dir.length() > 1 && p_dir.ends_with("/")) {
|
||||
p_dir = p_dir.substr(0, p_dir.length() - 1);
|
||||
}
|
||||
|
||||
if (p_dir.begins_with("/"))
|
||||
if (p_dir.begins_with("/")) {
|
||||
new_dir = p_dir.substr(1, p_dir.length());
|
||||
else if (p_dir.begins_with("res://"))
|
||||
} else if (p_dir.begins_with("res://")) {
|
||||
new_dir = p_dir.substr(6, p_dir.length());
|
||||
else if (current_dir.is_empty())
|
||||
} else if (current_dir.is_empty()) {
|
||||
new_dir = p_dir;
|
||||
else
|
||||
} else {
|
||||
new_dir = current_dir.plus_file(p_dir);
|
||||
}
|
||||
|
||||
//test if newdir exists
|
||||
new_dir = new_dir.simplify_path();
|
||||
|
@ -125,8 +132,9 @@ Error DirAccessJAndroid::change_dir(String p_dir) {
|
|||
jstring js = env->NewStringUTF(new_dir.utf8().get_data());
|
||||
int res = env->CallIntMethod(io, _dir_open, js);
|
||||
env->DeleteLocalRef(js);
|
||||
if (res <= 0)
|
||||
if (res <= 0) {
|
||||
return ERR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
env->CallVoidMethod(io, _dir_close, res);
|
||||
|
||||
|
@ -141,10 +149,11 @@ String DirAccessJAndroid::get_current_dir(bool p_include_drive) {
|
|||
|
||||
bool DirAccessJAndroid::file_exists(String p_file) {
|
||||
String sd;
|
||||
if (current_dir.is_empty())
|
||||
if (current_dir.is_empty()) {
|
||||
sd = p_file;
|
||||
else
|
||||
} else {
|
||||
sd = current_dir.plus_file(p_file);
|
||||
}
|
||||
|
||||
FileAccessAndroid *f = memnew(FileAccessAndroid);
|
||||
bool exists = f->file_exists(sd);
|
||||
|
@ -158,27 +167,30 @@ bool DirAccessJAndroid::dir_exists(String p_dir) {
|
|||
|
||||
String sd;
|
||||
|
||||
if (current_dir.is_empty())
|
||||
if (current_dir.is_empty()) {
|
||||
sd = p_dir;
|
||||
else {
|
||||
if (p_dir.is_relative_path())
|
||||
} else {
|
||||
if (p_dir.is_relative_path()) {
|
||||
sd = current_dir.plus_file(p_dir);
|
||||
else
|
||||
} else {
|
||||
sd = fix_path(p_dir);
|
||||
}
|
||||
}
|
||||
|
||||
String path = sd.simplify_path();
|
||||
|
||||
if (path.begins_with("/"))
|
||||
if (path.begins_with("/")) {
|
||||
path = path.substr(1, path.length());
|
||||
else if (path.begins_with("res://"))
|
||||
} else if (path.begins_with("res://")) {
|
||||
path = path.substr(6, path.length());
|
||||
}
|
||||
|
||||
jstring js = env->NewStringUTF(path.utf8().get_data());
|
||||
int res = env->CallIntMethod(io, _dir_open, js);
|
||||
env->DeleteLocalRef(js);
|
||||
if (res <= 0)
|
||||
if (res <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
env->CallVoidMethod(io, _dir_close, res);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue