diff options
| author | Juan Linietsky | 2015-05-04 15:06:41 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2015-05-04 15:06:41 -0300 |
| commit | 2a02d3f96f8fa3ed844a9abf58c0bf4d8023ebcc (patch) | |
| tree | d0ccaa72576f155b1b02b8cd7680eea3df684ed3 /core/ustring.cpp | |
| parent | fbbe7dcdfbd09fc6ef5614dea2183481a27e4f4e (diff) | |
| download | godot-2a02d3f96f8fa3ed844a9abf58c0bf4d8023ebcc.tar.gz godot-2a02d3f96f8fa3ed844a9abf58c0bf4d8023ebcc.tar.zst godot-2a02d3f96f8fa3ed844a9abf58c0bf4d8023ebcc.zip | |
fix font import path on windows, closes #1675
Diffstat (limited to 'core/ustring.cpp')
| -rw-r--r-- | core/ustring.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index ffd22c1f8..5df95ac4c 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3297,8 +3297,11 @@ String String::path_to_file(const String& p_path) const { String src=this->replace("\\","/").get_base_dir(); String dst=p_path.replace("\\","/").get_base_dir(); - - return src.path_to(dst)+p_path.get_file(); + String rel = src.path_to(dst); + if (rel==dst) // failed + return p_path; + else + return rel+p_path.get_file(); } String String::path_to(const String& p_path) const { @@ -3333,7 +3336,9 @@ String String::path_to(const String& p_path) const { String src_begin=src.get_slice("/",0); String dst_begin=dst.get_slice("/",0); - ERR_FAIL_COND_V(src_begin!=dst_begin,p_path); //return dst absolute path + if (src_begin!=dst_begin) + return p_path; //impossible to do this + base=src_begin; src=src.substr(src_begin.length(),src.length()); dst=dst.substr(dst_begin.length(),dst.length()); |
