From 42a16ef76e4100c285a4a8c17f22a199986072a7 Mon Sep 17 00:00:00 2001 From: Lamia Date: Mon, 8 Aug 2022 20:02:31 +1000 Subject: fix: modifies workspace->root_uri so that p_uri is symmetrical to other operating systems. #63388 --- modules/gdscript/language_server/gdscript_language_protocol.cpp | 4 +++- modules/gdscript/language_server/gdscript_workspace.cpp | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'modules/gdscript/language_server') diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp index c0d5856be5..39f4c976a4 100644 --- a/modules/gdscript/language_server/gdscript_language_protocol.cpp +++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp @@ -184,7 +184,9 @@ Dictionary GDScriptLanguageProtocol::initialize(const Dictionary &p_params) { if (root_uri.length() && is_same_workspace) { workspace->root_uri = root_uri; } else { - workspace->root_uri = "file://" + workspace->root; + String r_root = workspace->root; + r_root = r_root.lstrip("/"); + workspace->root_uri = "file:///" + r_root; Dictionary params; params["path"] = workspace->root; diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp index ded2a7b4d4..44b60369ab 100644 --- a/modules/gdscript/language_server/gdscript_workspace.cpp +++ b/modules/gdscript/language_server/gdscript_workspace.cpp @@ -500,10 +500,8 @@ Error GDScriptWorkspace::parse_local_script(const String &p_path) { String GDScriptWorkspace::get_file_path(const String &p_uri) const { String path = p_uri; - path = path.replace("///", "//"); - path = path.replace("%3A", ":"); - path = path.replacen(root_uri + "/", "res://"); path = path.uri_decode(); + path = path.replacen(root_uri + "/", "res://"); return path; } -- cgit v1.2.3