fix: handle fileStat for win

This commit is contained in:
Nurul Huda (Apon) 2025-11-05 20:59:02 +06:00
parent 3c4bc993e8
commit 87a146eff4
No known key found for this signature in database
GPG Key ID: 5D3F1DE2855A2F79
2 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,6 @@
.{
.name = .zx,
.version = "0.0.1-dev.22",
.version = "0.0.1-dev.23",
.fingerprint = 0xcad77a8d2a3389f2,
.minimum_zig_version = "0.15.2",
.dependencies = .{

View File

@ -302,9 +302,12 @@ fn transpileCommand(
include_zig: bool,
) !void {
// Check if path is a file or directory
const stat = std.fs.cwd().statFile(path) catch |err| {
std.debug.print("Error: Could not access path '{s}': {}\n", .{ path, err });
return err;
const stat = std.fs.cwd().statFile(path) catch |err| switch (err) {
error.IsDir => std.fs.File.Stat{ .kind = .directory, .size = 0, .mode = 0, .atime = 0, .mtime = 0, .ctime = 0, .inode = 0 },
else => {
std.debug.print("Error: Could not access path '{s}': {}\n", .{ path, err });
return err;
},
};
if (stat.kind == .directory) {