diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-07-01 12:06:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-01 12:06:35 +0200 |
commit | d17eac735cc84abd9afd1e083df1a4e8a2c8e656 (patch) | |
tree | d006c3a5457edbde9e4f9016b48d0968d70e3ce5 /modules | |
parent | b62041d1f3b6428974d5be7ad9d378a445d432ac (diff) | |
parent | d2833d4f4d891b6a0ee32a04f9d32a410b998b93 (diff) |
Merge pull request #29815 from NilsIrl/plus_file_1
Replace ` + "/" + ` with `String::file_add()`
Diffstat (limited to 'modules')
-rw-r--r-- | modules/assimp/editor_scene_importer_assimp.cpp | 32 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 2 |
2 files changed, 17 insertions, 17 deletions
diff --git a/modules/assimp/editor_scene_importer_assimp.cpp b/modules/assimp/editor_scene_importer_assimp.cpp index 8c3c04674b..093e2f3006 100644 --- a/modules/assimp/editor_scene_importer_assimp.cpp +++ b/modules/assimp/editor_scene_importer_assimp.cpp @@ -848,7 +848,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta if (AI_SUCCESS == ai_material->GetTexture(tex_normal, 0, &ai_filename, NULL, NULL, NULL, NULL, map_mode)) { filename = _assimp_raw_string_to_string(ai_filename); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -869,7 +869,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta if (AI_SUCCESS == ai_material->Get(AI_MATKEY_FBX_NORMAL_TEXTURE, ai_filename)) { filename = _assimp_raw_string_to_string(ai_filename); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -892,7 +892,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta if (AI_SUCCESS == ai_material->GetTexture(tex_emissive, 0, &ai_filename, NULL, NULL, NULL, NULL, map_mode)) { filename = _assimp_raw_string_to_string(ai_filename); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -914,7 +914,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta aiTextureMapMode map_mode[2]; if (AI_SUCCESS == ai_material->GetTexture(tex_albedo, 0, &ai_filename, NULL, NULL, NULL, NULL, map_mode)) { filename = _assimp_raw_string_to_string(ai_filename); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -944,7 +944,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta aiTextureMapMode map_mode[2]; if (AI_SUCCESS == ai_material->GetTexture(AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_TEXTURE, &tex_gltf_base_color_path, NULL, NULL, NULL, NULL, map_mode)) { String filename = _assimp_raw_string_to_string(tex_gltf_base_color_path); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -973,7 +973,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta aiString tex_fbx_pbs_base_color_path = aiString(); if (AI_SUCCESS == ai_material->Get(AI_MATKEY_FBX_MAYA_BASE_COLOR_TEXTURE, tex_fbx_pbs_base_color_path)) { String filename = _assimp_raw_string_to_string(tex_fbx_pbs_base_color_path); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -1005,7 +1005,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta aiString tex_fbx_pbs_normal_path = aiString(); if (AI_SUCCESS == ai_material->Get(AI_MATKEY_FBX_MAYA_NORMAL_TEXTURE, tex_fbx_pbs_normal_path)) { String filename = _assimp_raw_string_to_string(tex_fbx_pbs_normal_path); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -1027,7 +1027,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta aiString tex_fbx_stingray_normal_path = aiString(); if (AI_SUCCESS == ai_material->Get(AI_MATKEY_FBX_MAYA_STINGRAY_NORMAL_TEXTURE, tex_fbx_stingray_normal_path)) { String filename = _assimp_raw_string_to_string(tex_fbx_stingray_normal_path); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -1045,7 +1045,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta aiString tex_fbx_pbs_base_color_path = aiString(); if (AI_SUCCESS == ai_material->Get(AI_MATKEY_FBX_MAYA_STINGRAY_COLOR_TEXTURE, tex_fbx_pbs_base_color_path)) { String filename = _assimp_raw_string_to_string(tex_fbx_pbs_base_color_path); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -1077,7 +1077,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta aiString tex_fbx_pbs_emissive_path = aiString(); if (AI_SUCCESS == ai_material->Get(AI_MATKEY_FBX_MAYA_STINGRAY_EMISSIVE_TEXTURE, tex_fbx_pbs_emissive_path)) { String filename = _assimp_raw_string_to_string(tex_fbx_pbs_emissive_path); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -1107,7 +1107,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta aiString tex_gltf_pbr_metallicroughness_path; if (AI_SUCCESS == ai_material->GetTexture(AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLICROUGHNESS_TEXTURE, &tex_gltf_pbr_metallicroughness_path)) { String filename = _assimp_raw_string_to_string(tex_gltf_pbr_metallicroughness_path); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -1134,7 +1134,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta aiString tex_fbx_pbs_metallic_path; if (AI_SUCCESS == ai_material->Get(AI_MATKEY_FBX_MAYA_STINGRAY_METALLIC_TEXTURE, tex_fbx_pbs_metallic_path)) { String filename = _assimp_raw_string_to_string(tex_fbx_pbs_metallic_path); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -1154,7 +1154,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta aiString tex_fbx_pbs_rough_path; if (AI_SUCCESS == ai_material->Get(AI_MATKEY_FBX_MAYA_STINGRAY_ROUGHNESS_TEXTURE, tex_fbx_pbs_rough_path)) { String filename = _assimp_raw_string_to_string(tex_fbx_pbs_rough_path); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -1177,7 +1177,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta aiString tex_fbx_pbs_metallic_path; if (AI_SUCCESS == ai_material->Get(AI_MATKEY_FBX_MAYA_METALNESS_TEXTURE, tex_fbx_pbs_metallic_path)) { String filename = _assimp_raw_string_to_string(tex_fbx_pbs_metallic_path); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -1197,7 +1197,7 @@ Ref<Material> EditorSceneImporterAssimp::_generate_material_from_index(ImportSta aiString tex_fbx_pbs_rough_path; if (AI_SUCCESS == ai_material->Get(AI_MATKEY_FBX_MAYA_DIFFUSE_ROUGHNESS_TEXTURE, tex_fbx_pbs_rough_path)) { String filename = _assimp_raw_string_to_string(tex_fbx_pbs_rough_path); - String path = state.path.get_base_dir() + "/" + filename.replace("\\", "/"); + String path = state.path.get_base_dir().plus_file(filename.replace("\\", "/")); bool found = false; _find_texture_path(state.path, path, found); if (found) { @@ -1684,7 +1684,7 @@ void EditorSceneImporterAssimp::_find_texture_path(const String &p_path, _Direct path = name; return; } - String name_ignore_sub_directory = p_path.get_base_dir() + "/" + path.get_file().get_basename() + extension; + String name_ignore_sub_directory = p_path.get_base_dir().plus_file(path.get_file().get_basename()) + extension; if (dir.file_exists(name_ignore_sub_directory)) { found = true; path = name_ignore_sub_directory; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index a4a27c39d7..9ab86a5459 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -463,7 +463,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s } if (!path.is_abs_path() && base_path != "") - path = base_path + "/" + path; + path = base_path.plus_file(path); path = path.replace("///", "//").simplify_path(); if (path == self_path) { |