Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bundows] Skip unnecessary GetFinalPathNameByHandle #10338

Merged
merged 12 commits into from
Jul 9, 2024
Merged
18 changes: 18 additions & 0 deletions src/sys.zig
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,24 @@
return .{ .result = norm };
}

if (std.mem.indexOfAny(T, path_, &.{ '\\', '/', '.' }) == null) {

Check failure on line 783 in src/sys.zig

View workflow job for this annotation

GitHub Actions / Lint / Lint

Lint failure: std.mem.indexOfAny( is banned, Use bun.strings.indexOfAny
if (buf.len < path.len) {
return .{
.err = .{
.errno = @intFromEnum(bun.C.E.NOMEM),
.syscall = .open,
},
};
}

// Skip the system call to get the final path name if it doesn't have any of the above characters.
@memcpy(buf[0..path.len], path);
buf[path.len] = 0;
return .{
.result = buf[0..path.len :0],
};
}

const base_fd = if (dir_fd == bun.invalid_fd)
std.fs.cwd().fd
else
Expand Down
Loading