summaryrefslogtreecommitdiff
path: root/lsp-parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'lsp-parse.c')
-rw-r--r--lsp-parse.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lsp-parse.c b/lsp-parse.c
index f794c4b..fd07913 100644
--- a/lsp-parse.c
+++ b/lsp-parse.c
@@ -101,7 +101,17 @@ static bool parse_document_uri(LSP *lsp, const JSON *json, JSONValue value, LSPD
free(string);
return false;
}
- *id = lsp_document_id(lsp, string + strlen("file://"));
+ char *path;
+ #if _WIN32
+ path = string + strlen("file:///");
+ // replace slashes with backslashes
+ for (char *p = path; *p; ++p)
+ if (*p == '/')
+ *p = '\\';
+ #else
+ path = string + strlen("file://");
+ #endif
+ *id = lsp_document_id(lsp, path);
free(string);
return true;
}