diff --git a/src/cli/create_command.zig b/src/cli/create_command.zig index 22bc494ae7352f..0e5fffff14971b 100644 --- a/src/cli/create_command.zig +++ b/src/cli/create_command.zig @@ -1611,9 +1611,7 @@ pub const CreateCommand = struct { const outdir_path = filesystem.absBuf(&parts, &home_dir_buf); home_dir_buf[outdir_path.len] = 0; const outdir_path_ = home_dir_buf[0..outdir_path.len :0]; - if (!bun.sys.existsAt(bun.invalid_fd, outdir_path_)) { - break :outer; - } + std.fs.accessAbsoluteZ(outdir_path_, .{}) catch break :outer; example_tag = Example.Tag.local_folder; break :brk outdir_path; } @@ -1624,9 +1622,7 @@ pub const CreateCommand = struct { const outdir_path = filesystem.absBuf(&parts, &home_dir_buf); home_dir_buf[outdir_path.len] = 0; const outdir_path_ = home_dir_buf[0..outdir_path.len :0]; - if (!bun.sys.existsAt(bun.invalid_fd, outdir_path_)) { - break :outer; - } + std.fs.accessAbsoluteZ(outdir_path_, .{}) catch break :outer; example_tag = Example.Tag.local_folder; break :brk outdir_path; } @@ -1637,9 +1633,7 @@ pub const CreateCommand = struct { const outdir_path = filesystem.absBuf(&parts, &home_dir_buf); home_dir_buf[outdir_path.len] = 0; const outdir_path_ = home_dir_buf[0..outdir_path.len :0]; - if (!bun.sys.existsAt(bun.invalid_fd, outdir_path_)) { - break :outer; - } + std.fs.accessAbsoluteZ(outdir_path_, .{}) catch break :outer; example_tag = Example.Tag.local_folder; break :brk outdir_path; } diff --git a/src/sys.zig b/src/sys.zig index ba7c690f72288e..33c34857552a73 100644 --- a/src/sys.zig +++ b/src/sys.zig @@ -2120,7 +2120,7 @@ pub fn exists(path: []const u8) bool { pub fn existsAt(fd: bun.FileDescriptor, subpath: []const u8) bool { if (comptime Environment.isPosix) { - return system.faccessat(fd.cast(), &(std.os.toPosixPath(subpath) catch return false), 0, 0) == 0; + return system.faccessat(bun.toFD(fd), &(std.os.toPosixPath(subpath) catch return false), 0, 0) == 0; } if (comptime Environment.isWindows) {