Merge pull request #29815 from NilsIrl/plus_file_1
Replace ` + "/" + ` with `String::file_add()`
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user