summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredia Huya-Kouadio <fhuyakou@gmail.com>2020-12-23 00:48:18 -0800
committerFredia Huya-Kouadio <fhuyakou@gmail.com>2020-12-23 00:48:18 -0800
commit8edacea04a98ac8b87cfa96bfb5af55ff5c1b354 (patch)
treebd04a253c9ac62e7fab294b461f437571a131cd3
parent187be733aac2cb368ee23254d199ff4c71162701 (diff)
Fix the `String::get_base_dir()` logic to properly check for top level directories on Windows.
-rw-r--r--core/string/ustring.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index d630e987ea..fee168993b 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -4285,7 +4285,10 @@ bool String::is_rel_path() const {
}
String String::get_base_dir() const {
- int basepos = find("://");
+ int basepos = find(":/");
+ if (basepos == -1) {
+ basepos = find(":\\");
+ }
String rs;
String base;
if (basepos != -1) {