feat(local_prov): fix path separator
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user