From 9c35f84fd516143348790752b03f41bb4f892c35 Mon Sep 17 00:00:00 2001 From: Garo Brik Date: Thu, 4 Feb 2021 15:54:57 -0800 Subject: [PATCH] escape the project root we compare paths against --- src/indexer/IndexerMain.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/indexer/IndexerMain.cpp b/src/indexer/IndexerMain.cpp index 0c89341dc9..7366fdba4b 100644 --- a/src/indexer/IndexerMain.cpp +++ b/src/indexer/IndexerMain.cpp @@ -126,12 +126,11 @@ int main(int argc, const char **argv) { std::string ProjectRoot = ProjectRootArg; if (ProjectRoot == "") { - SmallString<128> CurrentPath; + SmallString<1024> CurrentPath; sys::fs::current_path(CurrentPath); - ProjectRoot = std::string("file://") + CurrentPath.c_str(); - } else if (ProjectRoot.rfind("file://", 0) != 0) { - ProjectRoot = std::string("file://") + ProjectRoot; + ProjectRoot = std::string(CurrentPath.c_str()); } + ProjectRoot = clang::clangd::URI("file", "", ProjectRoot).toString(); if (DebugArg) { llvm::errs() << "Using project root " << ProjectRoot << "\n"; }