feat(local_prov): fix path separator

This commit is contained in:
2025-05-14 05:45:29 +02:00
parent 8b9e51cf30
commit 4eda4d335b

View File

@@ -56,18 +56,18 @@ pub const LocalContentProvider = struct {
initContext: *const InitContext,
allocator: std.mem.Allocator,
) GetItemsError!*Item {
const path = try std.mem.replaceOwned(u8, allocator, fullName.path, "/", "\\");
defer allocator.free(path);
const native_path = try std.mem.replaceOwned(u8, allocator, fullName.path, "/", std.fs.path.sep_str);
defer allocator.free(native_path);
const kind: union(enum) { directory, file } = blk: {
// FIXME: properly handle different errors
var dir = std.fs.cwd().openDir(path, .{});
var dir = std.fs.cwd().openDir(native_path, .{});
if (dir) |*d| {
d.close();
break :blk .directory;
} else |_| {}
var file = std.fs.cwd().openFile(path, .{});
var file = std.fs.cwd().openFile(native_path, .{});
if (file) |*f| {
f.close();
break :blk .file;