From 94aa09a854d68bdc2d873618262e629b82d68635 Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Wed, 23 Dec 2020 00:43:03 -0800 Subject: [PATCH] Fix the `String::get_base_dir()` logic to properly check for top level directories on Windows. --- core/ustring.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/ustring.cpp b/core/ustring.cpp index 78685a44b01..84c6eebbf98 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3970,7 +3970,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) {