Rename String plus_file to path_join
This commit is contained in:
parent
051f24b067
commit
10a56981dc
100 changed files with 519 additions and 519 deletions
|
|
@ -72,7 +72,7 @@ String ProjectSettings::get_safe_project_name() const {
|
|||
}
|
||||
|
||||
String ProjectSettings::get_imported_files_path() const {
|
||||
return get_project_data_path().plus_file("imported");
|
||||
return get_project_data_path().path_join("imported");
|
||||
}
|
||||
|
||||
// Returns the features that a project must have when opened with this build of Godot.
|
||||
|
|
@ -157,12 +157,12 @@ String ProjectSettings::localize_path(const String &p_path) const {
|
|||
// in an absolute path that just happens to contain this string but points to a
|
||||
// different folder (e.g. "/my/project" as resource_path would be contained in
|
||||
// "/my/project_data", even though the latter is not part of res://.
|
||||
// `plus_file("")` is an easy way to ensure we have a trailing '/'.
|
||||
const String res_path = resource_path.plus_file("");
|
||||
// `path_join("")` is an easy way to ensure we have a trailing '/'.
|
||||
const String res_path = resource_path.path_join("");
|
||||
|
||||
// DirAccess::get_current_dir() is not guaranteed to return a path that with a trailing '/',
|
||||
// so we must make sure we have it as well in order to compare with 'res_path'.
|
||||
cwd = cwd.plus_file("");
|
||||
cwd = cwd.path_join("");
|
||||
|
||||
if (!cwd.begins_with(res_path)) {
|
||||
return p_path;
|
||||
|
|
@ -472,7 +472,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
|||
if (err == OK && !p_ignore_override) {
|
||||
// Load override from location of the main pack
|
||||
// Optional, we don't mind if it fails
|
||||
_load_settings_text(p_main_pack.get_base_dir().plus_file("override.cfg"));
|
||||
_load_settings_text(p_main_pack.get_base_dir().path_join("override.cfg"));
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
|
@ -500,14 +500,14 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
|||
#ifdef MACOS_ENABLED
|
||||
if (!found) {
|
||||
// Attempt to load PCK from macOS .app bundle resources.
|
||||
found = _load_resource_pack(OS::get_singleton()->get_bundle_resource_dir().plus_file(exec_basename + ".pck")) || _load_resource_pack(OS::get_singleton()->get_bundle_resource_dir().plus_file(exec_filename + ".pck"));
|
||||
found = _load_resource_pack(OS::get_singleton()->get_bundle_resource_dir().path_join(exec_basename + ".pck")) || _load_resource_pack(OS::get_singleton()->get_bundle_resource_dir().path_join(exec_filename + ".pck"));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!found) {
|
||||
// Try to load data pack at the location of the executable.
|
||||
// As mentioned above, we have two potential names to attempt.
|
||||
found = _load_resource_pack(exec_dir.plus_file(exec_basename + ".pck")) || _load_resource_pack(exec_dir.plus_file(exec_filename + ".pck"));
|
||||
found = _load_resource_pack(exec_dir.path_join(exec_basename + ".pck")) || _load_resource_pack(exec_dir.path_join(exec_filename + ".pck"));
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
|
|
@ -523,7 +523,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
|||
// Load overrides from the PCK and the executable location.
|
||||
// Optional, we don't mind if either fails.
|
||||
_load_settings_text("res://override.cfg");
|
||||
_load_settings_text(exec_path.get_base_dir().plus_file("override.cfg"));
|
||||
_load_settings_text(exec_path.get_base_dir().path_join("override.cfg"));
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
|
@ -556,10 +556,10 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
|||
// Set the resource path early so things can be resolved when loading.
|
||||
resource_path = current_dir;
|
||||
resource_path = resource_path.replace("\\", "/"); // Windows path to Unix path just in case.
|
||||
err = _load_settings_text_or_binary(current_dir.plus_file("project.godot"), current_dir.plus_file("project.binary"));
|
||||
err = _load_settings_text_or_binary(current_dir.path_join("project.godot"), current_dir.path_join("project.binary"));
|
||||
if (err == OK && !p_ignore_override) {
|
||||
// Optional, we don't mind if it fails.
|
||||
_load_settings_text(current_dir.plus_file("override.cfg"));
|
||||
_load_settings_text(current_dir.path_join("override.cfg"));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -685,7 +685,7 @@ Error ProjectSettings::_load_settings_text(const String &p_path) {
|
|||
// If we're loading a project.godot from source code, we can operate some
|
||||
// ProjectSettings conversions if need be.
|
||||
_convert_to_last_version(config_version);
|
||||
last_save_time = FileAccess::get_modified_time(get_resource_path().plus_file("project.godot"));
|
||||
last_save_time = FileAccess::get_modified_time(get_resource_path().path_join("project.godot"));
|
||||
return OK;
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(err != OK, err, "Error parsing " + p_path + " at line " + itos(lines) + ": " + error_text + " File might be corrupted.");
|
||||
|
|
@ -764,9 +764,9 @@ void ProjectSettings::clear(const String &p_name) {
|
|||
}
|
||||
|
||||
Error ProjectSettings::save() {
|
||||
Error error = save_custom(get_resource_path().plus_file("project.godot"));
|
||||
Error error = save_custom(get_resource_path().path_join("project.godot"));
|
||||
if (error == OK) {
|
||||
last_save_time = FileAccess::get_modified_time(get_resource_path().plus_file("project.godot"));
|
||||
last_save_time = FileAccess::get_modified_time(get_resource_path().path_join("project.godot"));
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
|
@ -911,7 +911,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
|
|||
}
|
||||
}
|
||||
// Check for the existence of a csproj file.
|
||||
if (FileAccess::exists(get_resource_path().plus_file(get_safe_project_name() + ".csproj"))) {
|
||||
if (FileAccess::exists(get_resource_path().path_join(get_safe_project_name() + ".csproj"))) {
|
||||
// If there is a csproj file, add the C# feature if it doesn't already exist.
|
||||
if (!project_features.has("C#")) {
|
||||
project_features.append("C#");
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#include "core/os/os.h"
|
||||
|
||||
String NativeExtension::get_extension_list_config_file() {
|
||||
return ProjectSettings::get_singleton()->get_project_data_path().plus_file("extension_list.cfg");
|
||||
return ProjectSettings::get_singleton()->get_project_data_path().path_join("extension_list.cfg");
|
||||
}
|
||||
|
||||
class NativeExtensionMethodBind : public MethodBind {
|
||||
|
|
@ -421,7 +421,7 @@ Ref<Resource> NativeExtensionResourceLoader::load(const String &p_path, const St
|
|||
}
|
||||
|
||||
if (!library_path.is_resource_file() && !library_path.is_absolute_path()) {
|
||||
library_path = p_path.get_base_dir().plus_file(library_path);
|
||||
library_path = p_path.get_base_dir().path_join(library_path);
|
||||
}
|
||||
|
||||
Ref<NativeExtension> lib;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ static Error _erase_recursive(DirAccess *da) {
|
|||
if (err) {
|
||||
return err;
|
||||
}
|
||||
err = da->remove(da->get_current_dir().plus_file(E));
|
||||
err = da->remove(da->get_current_dir().path_join(E));
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ static Error _erase_recursive(DirAccess *da) {
|
|||
}
|
||||
|
||||
for (const String &E : files) {
|
||||
Error err = da->remove(da->get_current_dir().plus_file(E));
|
||||
Error err = da->remove(da->get_current_dir().path_join(E));
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ Error DirAccess::make_dir_recursive(String p_dir) {
|
|||
|
||||
if (p_dir.is_relative_path()) {
|
||||
//append current
|
||||
full_dir = get_current_dir().plus_file(p_dir);
|
||||
full_dir = get_current_dir().path_join(p_dir);
|
||||
|
||||
} else {
|
||||
full_dir = p_dir;
|
||||
|
|
@ -172,7 +172,7 @@ Error DirAccess::make_dir_recursive(String p_dir) {
|
|||
|
||||
String curpath = base;
|
||||
for (int i = 0; i < subdirs.size(); i++) {
|
||||
curpath = curpath.plus_file(subdirs[i]);
|
||||
curpath = curpath.path_join(subdirs[i]);
|
||||
Error err = make_dir(curpath);
|
||||
if (err != OK && err != ERR_ALREADY_EXISTS) {
|
||||
ERR_FAIL_V_MSG(err, "Could not create directory: " + curpath);
|
||||
|
|
@ -354,8 +354,8 @@ Error DirAccess::_copy_dir(Ref<DirAccess> &p_target_da, String p_to, int p_chmod
|
|||
String n = get_next();
|
||||
while (!n.is_empty()) {
|
||||
if (n != "." && n != "..") {
|
||||
if (p_copy_links && is_link(get_current_dir().plus_file(n))) {
|
||||
create_link(read_link(get_current_dir().plus_file(n)), p_to + n);
|
||||
if (p_copy_links && is_link(get_current_dir().path_join(n))) {
|
||||
create_link(read_link(get_current_dir().path_join(n)), p_to + n);
|
||||
} else if (current_is_dir()) {
|
||||
dirs.push_back(n);
|
||||
} else {
|
||||
|
|
@ -364,7 +364,7 @@ Error DirAccess::_copy_dir(Ref<DirAccess> &p_target_da, String p_to, int p_chmod
|
|||
list_dir_end();
|
||||
return ERR_BUG;
|
||||
}
|
||||
Error err = copy(get_current_dir().plus_file(n), p_to + rel_path, p_chmod_flags);
|
||||
Error err = copy(get_current_dir().path_join(n), p_to + rel_path, p_chmod_flags);
|
||||
if (err) {
|
||||
list_dir_end();
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ String DirAccessPack::get_current_dir(bool p_include_drive) const {
|
|||
|
||||
while (pd->parent) {
|
||||
pd = pd->parent;
|
||||
p = pd->name.plus_file(p);
|
||||
p = pd->name.path_join(p);
|
||||
}
|
||||
|
||||
return "res://" + p;
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
|
|||
|
||||
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(res_path.get_base_dir().plus_file(path));
|
||||
path = ProjectSettings::get_singleton()->localize_path(res_path.get_base_dir().path_join(path));
|
||||
}
|
||||
|
||||
if (remaps.find(path)) {
|
||||
|
|
@ -683,7 +683,7 @@ Error ResourceLoaderBinary::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(path.get_base_dir().plus_file(external_resources[i].path));
|
||||
path = ProjectSettings::get_singleton()->localize_path(path.get_base_dir().path_join(external_resources[i].path));
|
||||
}
|
||||
|
||||
external_resources.write[i].path = path; //remap happens here, not on load because on load it can actually be used for filesystem dock resource remap
|
||||
|
|
@ -1329,7 +1329,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
|
|||
|
||||
bool relative = false;
|
||||
if (!path.begins_with("res://")) {
|
||||
path = local_path.plus_file(path).simplify_path();
|
||||
path = local_path.path_join(path).simplify_path();
|
||||
relative = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_extension(const St
|
|||
}
|
||||
|
||||
String ResourceFormatImporter::get_import_base_path(const String &p_for_file) const {
|
||||
return ProjectSettings::get_singleton()->get_imported_files_path().plus_file(p_for_file.get_file() + "-" + p_for_file.md5_text());
|
||||
return ProjectSettings::get_singleton()->get_imported_files_path().path_join(p_for_file.get_file() + "-" + p_for_file.md5_text());
|
||||
}
|
||||
|
||||
bool ResourceFormatImporter::are_import_settings_valid(const String &p_path) const {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ static constexpr uint32_t char_count = ('z' - 'a');
|
|||
static constexpr uint32_t base = char_count + ('9' - '0');
|
||||
|
||||
String ResourceUID::get_cache_file() {
|
||||
return ProjectSettings::get_singleton()->get_project_data_path().plus_file("uid_cache.bin");
|
||||
return ProjectSettings::get_singleton()->get_project_data_path().path_join("uid_cache.bin");
|
||||
}
|
||||
|
||||
String ResourceUID::id_to_text(ID p_id) const {
|
||||
|
|
|
|||
|
|
@ -4451,7 +4451,7 @@ String String::get_extension() const {
|
|||
return substr(pos + 1, length());
|
||||
}
|
||||
|
||||
String String::plus_file(const String &p_file) const {
|
||||
String String::path_join(const String &p_file) const {
|
||||
if (is_empty()) {
|
||||
return p_file;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ public:
|
|||
String rstrip(const String &p_chars) const;
|
||||
String get_extension() const;
|
||||
String get_basename() const;
|
||||
String plus_file(const String &p_file) const;
|
||||
String path_join(const String &p_file) const;
|
||||
char32_t unicode_at(int p_idx) const;
|
||||
|
||||
void erase(int p_pos, int p_chars);
|
||||
|
|
|
|||
|
|
@ -1523,7 +1523,7 @@ static void _register_variant_builtin_methods() {
|
|||
bind_method(String, rstrip, sarray("chars"), varray());
|
||||
bind_method(String, get_extension, sarray(), varray());
|
||||
bind_method(String, get_basename, sarray(), varray());
|
||||
bind_method(String, plus_file, sarray("file"), varray());
|
||||
bind_method(String, path_join, sarray("file"), varray());
|
||||
bind_method(String, unicode_at, sarray("at"), varray());
|
||||
bind_method(String, indent, sarray("prefix"), varray());
|
||||
bind_method(String, dedent, sarray(), varray());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue