From d2833d4f4d891b6a0ee32a04f9d32a410b998b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20ANDR=C3=89-CHANG?= Date: Sun, 16 Jun 2019 13:31:57 +0100 Subject: [PATCH] Replace ` + "/" + ` with `String::file_add()` --- core/os/dir_access.cpp | 2 +- drivers/unix/dir_access_unix.cpp | 2 +- editor/collada/collada.cpp | 4 +-- editor/editor_file_system.cpp | 4 +-- editor/editor_help.cpp | 4 +-- editor/editor_node.cpp | 4 +-- editor/editor_settings.cpp | 2 +- editor/filesystem_dock.cpp | 2 +- editor/groups_editor.cpp | 2 +- editor/plugins/script_text_editor.cpp | 4 +-- main/main.cpp | 4 +-- .../assimp/editor_scene_importer_assimp.cpp | 32 +++++++++---------- modules/gdscript/gdscript_parser.cpp | 2 +- platform/android/export/export.cpp | 2 +- platform/iphone/export/export.cpp | 4 +-- platform/osx/export/export.cpp | 2 +- platform/x11/os_x11.cpp | 2 +- 17 files changed, 39 insertions(+), 39 deletions(-) diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index d81c30f33a28..ec80bf3ebf45 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -378,7 +378,7 @@ Error DirAccess::_copy_dir(DirAccess *p_target_da, String p_to, int p_chmod_flag list_dir_end(); return ERR_BUG; } - Error err = copy(get_current_dir() + "/" + n, p_to + rel_path, p_chmod_flags); + Error err = copy(get_current_dir().plus_file(n), p_to + rel_path, p_chmod_flags); if (err) { list_dir_end(); return err; diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp index e011176806b8..1c50ff27fc0e 100644 --- a/drivers/unix/dir_access_unix.cpp +++ b/drivers/unix/dir_access_unix.cpp @@ -316,7 +316,7 @@ Error DirAccessUnix::change_dir(String p_dir) { // try_dir is the directory we are trying to change into String try_dir = ""; if (p_dir.is_rel_path()) { - String next_dir = current_dir + "/" + p_dir; + String next_dir = current_dir.plus_file(p_dir); next_dir = next_dir.simplify_path(); try_dir = next_dir; } else { diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp index a0d319c81bf8..46a628b7a683 100644 --- a/editor/collada/collada.cpp +++ b/editor/collada/collada.cpp @@ -308,7 +308,7 @@ void Collada::_parse_image(XMLParser &parser) { String path = parser.get_attribute_value("source").strip_edges(); if (path.find("://") == -1 && path.is_rel_path()) { // path is relative to file being loaded, so convert to a resource path - image.path = ProjectSettings::get_singleton()->localize_path(state.local_path.get_base_dir() + "/" + path.percent_decode()); + image.path = ProjectSettings::get_singleton()->localize_path(state.local_path.get_base_dir().plus_file(path.percent_decode())); } } else { @@ -325,7 +325,7 @@ void Collada::_parse_image(XMLParser &parser) { if (path.find("://") == -1 && path.is_rel_path()) { // path is relative to file being loaded, so convert to a resource path - path = ProjectSettings::get_singleton()->localize_path(state.local_path.get_base_dir() + "/" + path); + path = ProjectSettings::get_singleton()->localize_path(state.local_path.get_base_dir().plus_file(path)); } else if (path.find("file:///") == 0) { path = path.replace_first("file:///", ""); diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 4ddb28b44084..c6faf8cea559 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -96,7 +96,7 @@ String EditorFileSystemDirectory::get_path() const { String p; const EditorFileSystemDirectory *d = this; while (d->parent) { - p = d->name + "/" + p; + p = d->name.plus_file(p); d = d->parent; } @@ -108,7 +108,7 @@ String EditorFileSystemDirectory::get_file_path(int p_idx) const { String file = get_file(p_idx); const EditorFileSystemDirectory *d = this; while (d->parent) { - file = d->name + "/" + file; + file = d->name.plus_file(file); d = d->parent; } diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index df25b08b4c4c..32c35e7225c3 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1284,7 +1284,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { end = bbcode.length(); String image = bbcode.substr(brk_end + 1, end - brk_end - 1); - Ref texture = ResourceLoader::load(base_path + "/" + image, "Texture"); + Ref texture = ResourceLoader::load(base_path.plus_file(image), "Texture"); if (texture.is_valid()) p_rt->add_image(texture); @@ -1340,7 +1340,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { String fnt = tag.substr(5, tag.length()); - Ref font = ResourceLoader::load(base_path + "/" + fnt, "Font"); + Ref font = ResourceLoader::load(base_path.plus_file(fnt), "Font"); if (font.is_valid()) p_rt->push_font(font); else { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 79c312b7b1bb..1263032a9563 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2806,7 +2806,7 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled, Ref cf; cf.instance(); - String addon_path = "res://addons/" + p_addon + "/plugin.cfg"; + String addon_path = String("res://addons").plus_file(p_addon).plus_file("plugin.cfg"); if (!DirAccess::exists(addon_path.get_base_dir())) { ProjectSettings *ps = ProjectSettings::get_singleton(); PoolStringArray enabled_plugins = ps->get("editor_plugins/enabled"); @@ -2833,7 +2833,7 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled, } String path = cf->get_value("plugin", "script"); - path = "res://addons/" + p_addon + "/" + path; + path = String("res://addons").plus_file(p_addon).plus_file(path); Ref