fix(windows): use std.fs.path.isAbsolute in Project.make_URI

This commit is contained in:
CJ van den Berg 2024-07-09 19:26:18 +02:00
parent 82b5f5433d
commit 4b694d4f0f

View file

@ -114,7 +114,7 @@ fn get_file_lsp(self: *Self, file_path: []const u8) !LSP {
fn make_URI(self: *Self, file_path: ?[]const u8) ![]const u8 {
var buf = std.ArrayList(u8).init(self.a);
if (file_path) |path| {
if (path.len > 0 and path[0] == std.fs.path.sep) {
if (std.fs.path.isAbsolute(path)) {
try buf.writer().print("file://{s}", .{path});
} else {
try buf.writer().print("file://{s}/{s}", .{ self.name, path });