summaryrefslogtreecommitdiff
path: root/src/Command.zig
diff options
context:
space:
mode:
authorMitchell Hashimoto <mitchell.hashimoto@gmail.com>2023-10-26 09:30:11 -0700
committerMitchell Hashimoto <mitchell.hashimoto@gmail.com>2023-10-26 09:30:11 -0700
commitb049cb7d21c48a5f18cae325208e71096f44d2d5 (patch)
tree617b1c47e5d971c57d33ba4c0a3018ad37b3b00b /src/Command.zig
parent41de71ae9e16d97f93fefa00802e9d167bb297aa (diff)
command: allow relative paths in PATH
Diffstat (limited to 'src/Command.zig')
-rw-r--r--src/Command.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Command.zig b/src/Command.zig
index 1f0e81bec..f963a1857 100644
--- a/src/Command.zig
+++ b/src/Command.zig
@@ -255,11 +255,11 @@ pub fn expandPath(alloc: Allocator, cmd: []const u8) !?[]u8 {
path_buf[path_len] = 0;
const full_path = path_buf[0..path_len :0];
- // Skip if this isn't an absolute path
- if (!std.fs.path.isAbsolute(full_path)) continue;
-
// Stat it
- const f = std.fs.openFileAbsolute(full_path, .{}) catch |err| switch (err) {
+ const f = std.fs.cwd().openFile(
+ full_path,
+ .{},
+ ) catch |err| switch (err) {
error.FileNotFound => continue,
error.AccessDenied => {
// Accumulate this and return it later so we can try other