Merge pull request #52240 from Rubonnek/rename-rel-path
Rename `String::is_rel_path` to `String::is_relative_path`
This commit is contained in:
commit
bcd73fc00a
23 changed files with 52 additions and 52 deletions
|
|
@ -1504,7 +1504,7 @@ String Directory::get_current_dir() {
|
|||
|
||||
Error Directory::make_dir(String p_dir) {
|
||||
ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory is not configured properly.");
|
||||
if (!p_dir.is_rel_path()) {
|
||||
if (!p_dir.is_relative_path()) {
|
||||
DirAccess *d = DirAccess::create_for_path(p_dir);
|
||||
Error err = d->make_dir(p_dir);
|
||||
memdelete(d);
|
||||
|
|
@ -1515,7 +1515,7 @@ Error Directory::make_dir(String p_dir) {
|
|||
|
||||
Error Directory::make_dir_recursive(String p_dir) {
|
||||
ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory is not configured properly.");
|
||||
if (!p_dir.is_rel_path()) {
|
||||
if (!p_dir.is_relative_path()) {
|
||||
DirAccess *d = DirAccess::create_for_path(p_dir);
|
||||
Error err = d->make_dir_recursive(p_dir);
|
||||
memdelete(d);
|
||||
|
|
@ -1526,7 +1526,7 @@ Error Directory::make_dir_recursive(String p_dir) {
|
|||
|
||||
bool Directory::file_exists(String p_file) {
|
||||
ERR_FAIL_COND_V_MSG(!d, false, "Directory is not configured properly.");
|
||||
if (!p_file.is_rel_path()) {
|
||||
if (!p_file.is_relative_path()) {
|
||||
return FileAccess::exists(p_file);
|
||||
}
|
||||
|
||||
|
|
@ -1535,7 +1535,7 @@ bool Directory::file_exists(String p_file) {
|
|||
|
||||
bool Directory::dir_exists(String p_dir) {
|
||||
ERR_FAIL_COND_V_MSG(!d, false, "Directory is not configured properly.");
|
||||
if (!p_dir.is_rel_path()) {
|
||||
if (!p_dir.is_relative_path()) {
|
||||
DirAccess *d = DirAccess::create_for_path(p_dir);
|
||||
bool exists = d->dir_exists(p_dir);
|
||||
memdelete(d);
|
||||
|
|
@ -1559,7 +1559,7 @@ Error Directory::rename(String p_from, String p_to) {
|
|||
ERR_FAIL_COND_V_MSG(!is_open(), ERR_UNCONFIGURED, "Directory must be opened before use.");
|
||||
ERR_FAIL_COND_V_MSG(p_from.is_empty() || p_from == "." || p_from == "..", ERR_INVALID_PARAMETER, "Invalid path to rename.");
|
||||
|
||||
if (!p_from.is_rel_path()) {
|
||||
if (!p_from.is_relative_path()) {
|
||||
DirAccess *d = DirAccess::create_for_path(p_from);
|
||||
ERR_FAIL_COND_V_MSG(!d->file_exists(p_from) && !d->dir_exists(p_from), ERR_DOES_NOT_EXIST, "File or directory does not exist.");
|
||||
Error err = d->rename(p_from, p_to);
|
||||
|
|
@ -1573,7 +1573,7 @@ Error Directory::rename(String p_from, String p_to) {
|
|||
|
||||
Error Directory::remove(String p_name) {
|
||||
ERR_FAIL_COND_V_MSG(!is_open(), ERR_UNCONFIGURED, "Directory must be opened before use.");
|
||||
if (!p_name.is_rel_path()) {
|
||||
if (!p_name.is_relative_path()) {
|
||||
DirAccess *d = DirAccess::create_for_path(p_name);
|
||||
Error err = d->remove(p_name);
|
||||
memdelete(d);
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ Error DirAccess::make_dir_recursive(String p_dir) {
|
|||
|
||||
String full_dir;
|
||||
|
||||
if (p_dir.is_rel_path()) {
|
||||
if (p_dir.is_relative_path()) {
|
||||
//append current
|
||||
full_dir = get_current_dir().plus_file(p_dir);
|
||||
|
||||
|
|
@ -345,7 +345,7 @@ Error DirAccess::_copy_dir(DirAccess *p_target_da, String p_to, int p_chmod_flag
|
|||
dirs.push_back(n);
|
||||
} else {
|
||||
const String &rel_path = n;
|
||||
if (!n.is_rel_path()) {
|
||||
if (!n.is_relative_path()) {
|
||||
list_dir_end();
|
||||
return ERR_BUG;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
|
|||
String exttype = get_unicode_string();
|
||||
String path = get_unicode_string();
|
||||
|
||||
if (path.find("://") == -1 && path.is_rel_path()) {
|
||||
if (path.find("://") == -1 && 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));
|
||||
}
|
||||
|
|
@ -626,7 +626,7 @@ Error ResourceLoaderBinary::load() {
|
|||
path = remaps[path];
|
||||
}
|
||||
|
||||
if (path.find("://") == -1 && path.is_rel_path()) {
|
||||
if (path.find("://") == -1 && 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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ static String _validate_local_path(const String &p_path) {
|
|||
ResourceUID::ID uid = ResourceUID::get_singleton()->text_to_id(p_path);
|
||||
if (uid != ResourceUID::INVALID_ID) {
|
||||
return ResourceUID::get_singleton()->get_id_path(uid);
|
||||
} else if (p_path.is_rel_path()) {
|
||||
} else if (p_path.is_relative_path()) {
|
||||
return "res://" + p_path;
|
||||
} else {
|
||||
return ProjectSettings::get_singleton()->localize_path(p_path);
|
||||
|
|
|
|||
|
|
@ -4324,7 +4324,7 @@ bool String::is_resource_file() const {
|
|||
return begins_with("res://") && find("::") == -1;
|
||||
}
|
||||
|
||||
bool String::is_rel_path() const {
|
||||
bool String::is_relative_path() const {
|
||||
return !is_absolute_path();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ public:
|
|||
|
||||
// path functions
|
||||
bool is_absolute_path() const;
|
||||
bool is_rel_path() const;
|
||||
bool is_relative_path() const;
|
||||
bool is_resource_file() const;
|
||||
String path_to(const String &p_path) const;
|
||||
String path_to_file(const String &p_path) const;
|
||||
|
|
|
|||
|
|
@ -1421,7 +1421,7 @@ static void _register_variant_builtin_methods() {
|
|||
//bind_method(String, humanize_size, sarray("size"), varray());
|
||||
|
||||
bind_method(String, is_absolute_path, sarray(), varray());
|
||||
bind_method(String, is_rel_path, sarray(), varray());
|
||||
bind_method(String, is_relative_path, sarray(), varray());
|
||||
bind_method(String, simplify_path, sarray(), varray());
|
||||
bind_method(String, get_base_dir, sarray(), varray());
|
||||
bind_method(String, get_file, sarray(), varray());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue