From 8edacea04a98ac8b87cfa96bfb5af55ff5c1b354 Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Wed, 23 Dec 2020 00:48:18 -0800 Subject: [PATCH] Fix the `String::get_base_dir()` logic to properly check for top level directories on Windows. --- core/string/ustring.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) {