Use append_ instead of parse_ for String methods.
This commit is contained in:
@ -342,7 +342,7 @@ Error DirAccessUnix::change_dir(String p_dir) {
|
||||
String prev_dir;
|
||||
char real_current_dir_name[2048];
|
||||
ERR_FAIL_NULL_V(getcwd(real_current_dir_name, 2048), ERR_BUG);
|
||||
if (prev_dir.parse_utf8(real_current_dir_name) != OK) {
|
||||
if (prev_dir.append_utf8(real_current_dir_name) != OK) {
|
||||
prev_dir = real_current_dir_name; //no utf8, maybe latin?
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ Error DirAccessUnix::change_dir(String p_dir) {
|
||||
if (!base.is_empty() && !try_dir.begins_with(base)) {
|
||||
ERR_FAIL_NULL_V(getcwd(real_current_dir_name, 2048), ERR_BUG);
|
||||
String new_dir;
|
||||
new_dir.parse_utf8(real_current_dir_name);
|
||||
new_dir.append_utf8(real_current_dir_name);
|
||||
|
||||
if (!new_dir.begins_with(base)) {
|
||||
try_dir = current_dir; //revert
|
||||
@ -486,7 +486,7 @@ String DirAccessUnix::read_link(String p_file) {
|
||||
ssize_t len = readlink(p_file.utf8().get_data(), buf, sizeof(buf));
|
||||
String link;
|
||||
if (len > 0) {
|
||||
link.parse_utf8(buf, len);
|
||||
link.append_utf8(buf, len);
|
||||
}
|
||||
return link;
|
||||
}
|
||||
@ -553,7 +553,8 @@ DirAccessUnix::DirAccessUnix() {
|
||||
// set current directory to an absolute path of the current directory
|
||||
char real_current_dir_name[2048];
|
||||
ERR_FAIL_NULL(getcwd(real_current_dir_name, 2048));
|
||||
if (current_dir.parse_utf8(real_current_dir_name) != OK) {
|
||||
current_dir.clear();
|
||||
if (current_dir.append_utf8(real_current_dir_name) != OK) {
|
||||
current_dir = real_current_dir_name;
|
||||
}
|
||||
|
||||
|
||||
@ -211,7 +211,7 @@ String FileAccessUnix::get_real_path() const {
|
||||
}
|
||||
|
||||
String result;
|
||||
Error parse_ok = result.parse_utf8(resolved_path);
|
||||
Error parse_ok = result.append_utf8(resolved_path);
|
||||
::free(resolved_path);
|
||||
|
||||
if (parse_ok != OK) {
|
||||
|
||||
@ -710,7 +710,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, St
|
||||
p_pipe_mutex->lock();
|
||||
}
|
||||
String pipe_out;
|
||||
if (pipe_out.parse_utf8(buf) == OK) {
|
||||
if (pipe_out.append_utf8(buf) == OK) {
|
||||
(*r_pipe) += pipe_out;
|
||||
} else {
|
||||
(*r_pipe) += String(buf); // If not valid UTF-8 try decode as Latin-1
|
||||
@ -942,7 +942,7 @@ String OS_Unix::get_environment(const String &p_var) const {
|
||||
return "";
|
||||
}
|
||||
String s;
|
||||
if (s.parse_utf8(val) == OK) {
|
||||
if (s.append_utf8(val) == OK) {
|
||||
return s;
|
||||
}
|
||||
return String(val); // Not valid UTF-8, so return as-is
|
||||
@ -971,7 +971,7 @@ String OS_Unix::get_executable_path() const {
|
||||
ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf));
|
||||
String b;
|
||||
if (len > 0) {
|
||||
b.parse_utf8(buf, len);
|
||||
b.append_utf8(buf, len);
|
||||
}
|
||||
if (b.is_empty()) {
|
||||
WARN_PRINT("Couldn't get executable path from /proc/self/exe, using argv[0]");
|
||||
@ -1008,7 +1008,7 @@ String OS_Unix::get_executable_path() const {
|
||||
return OS::get_executable_path();
|
||||
}
|
||||
String b;
|
||||
b.parse_utf8(buf);
|
||||
b.append_utf8(buf);
|
||||
return b;
|
||||
#elif defined(__APPLE__)
|
||||
char temp_path[1];
|
||||
|
||||
Reference in New Issue
Block a user