Merge pull request #65066 from aaronfranke/str-path-join

This commit is contained in:
Rémi Verschelde 2022-08-30 10:01:11 +02:00 committed by GitHub
commit 432b25d364
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
100 changed files with 519 additions and 519 deletions

View file

@ -163,7 +163,7 @@ Vector<String> FileDialog::get_selected_files() const {
TreeItem *item = tree->get_root();
while ((item = tree->get_next_selected(item))) {
list.push_back(dir_access->get_current_dir().plus_file(item->get_text(0)));
list.push_back(dir_access->get_current_dir().path_join(item->get_text(0)));
};
return list;
@ -192,7 +192,7 @@ void FileDialog::update_dir() {
}
void FileDialog::_dir_submitted(String p_dir) {
_change_dir(root_prefix.plus_file(p_dir));
_change_dir(root_prefix.path_join(p_dir));
file->set_text("");
_push_history();
}
@ -202,7 +202,7 @@ void FileDialog::_file_submitted(const String &p_file) {
}
void FileDialog::_save_confirm_pressed() {
String f = dir_access->get_current_dir().plus_file(file->get_text());
String f = dir_access->get_current_dir().path_join(file->get_text());
emit_signal(SNAME("file_selected"), f);
hide();
}
@ -252,7 +252,7 @@ void FileDialog::_action_pressed() {
Vector<String> files;
while (ti) {
files.push_back(fbase.plus_file(ti->get_text(0)));
files.push_back(fbase.path_join(ti->get_text(0)));
ti = tree->get_next_selected(ti);
}
@ -265,7 +265,7 @@ void FileDialog::_action_pressed() {
}
String file_text = file->get_text();
String f = file_text.is_absolute_path() ? file_text : dir_access->get_current_dir().plus_file(file_text);
String f = file_text.is_absolute_path() ? file_text : dir_access->get_current_dir().path_join(file_text);
if ((mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_FILE) && dir_access->file_exists(f)) {
emit_signal(SNAME("file_selected"), f);
@ -278,7 +278,7 @@ void FileDialog::_action_pressed() {
if (item) {
Dictionary d = item->get_metadata(0);
if (d["dir"] && d["name"] != "..") {
path = path.plus_file(d["name"]);
path = path.path_join(d["name"]);
}
}
@ -598,7 +598,7 @@ void FileDialog::update_file_list() {
ti->set_text(0, files.front()->get());
if (get_icon_func) {
Ref<Texture2D> icon = get_icon_func(base_dir.plus_file(files.front()->get()));
Ref<Texture2D> icon = get_icon_func(base_dir.path_join(files.front()->get()));
ti->set_icon(0, icon);
} else {
ti->set_icon(0, file_icon);
@ -706,7 +706,7 @@ String FileDialog::get_current_file() const {
}
String FileDialog::get_current_path() const {
return dir->get_text().plus_file(file->get_text());
return dir->get_text().path_join(file->get_text());
}
void FileDialog::set_current_dir(const String &p_dir) {

View file

@ -1370,9 +1370,9 @@ void SceneTree::get_argument_options(const StringName &p_function, int p_idx, Li
}
if (dir_access->dir_exists(filename)) {
directories.push_back(dir_access->get_current_dir().plus_file(filename));
directories.push_back(dir_access->get_current_dir().path_join(filename));
} else if (filename.ends_with(".tscn") || filename.ends_with(".scn")) {
r_options->push_back("\"" + dir_access->get_current_dir().plus_file(filename) + "\"");
r_options->push_back("\"" + dir_access->get_current_dir().path_join(filename) + "\"");
}
filename = dir_access->get_next();

View file

@ -1427,7 +1427,7 @@ Error FontFile::load_bitmap_font(const String &p_path) {
while (!f->eof_reached() && f->get_position() <= off + block_size) {
if (c == '\0') {
String base_dir = p_path.get_base_dir();
String file = base_dir.plus_file(String::utf8(cs.ptr(), cs.length()));
String file = base_dir.path_join(String::utf8(cs.ptr(), cs.length()));
if (RenderingServer::get_singleton() != nullptr) {
Ref<Image> img;
img.instantiate();
@ -1660,7 +1660,7 @@ Error FontFile::load_bitmap_font(const String &p_path) {
}
if (keys.has("file")) {
String base_dir = p_path.get_base_dir();
String file = base_dir.plus_file(keys["file"]);
String file = base_dir.path_join(keys["file"]);
if (RenderingServer::get_singleton() != nullptr) {
Ref<Image> img;
img.instantiate();

View file

@ -451,7 +451,7 @@ Error ResourceLoaderText::load() {
if (!path.contains("://") && path.is_relative_path()) {
// path is relative to file being loaded, so convert to a resource path
path = ProjectSettings::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path));
path = ProjectSettings::get_singleton()->localize_path(local_path.get_base_dir().path_join(path));
}
if (remaps.has(path)) {
@ -861,7 +861,7 @@ void ResourceLoaderText::get_dependencies(Ref<FileAccess> p_f, List<String> *p_d
if (!using_uid && !path.contains("://") && path.is_relative_path()) {
// path is relative to file being loaded, so convert to a resource path
path = ProjectSettings::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path));
path = ProjectSettings::get_singleton()->localize_path(local_path.get_base_dir().path_join(path));
}
if (p_add_types) {
@ -938,7 +938,7 @@ Error ResourceLoaderText::rename_dependencies(Ref<FileAccess> p_f, const String
}
bool relative = false;
if (!path.begins_with("res://")) {
path = base_path.plus_file(path).simplify_path();
path = base_path.path_join(path).simplify_path();
relative = true;
}