| ... | @@ -45,11 +45,7 @@ pub fn trim_prefix(in: []const u8, prefix: []const u8) []const u8 { | ... | @@ -45,11 +45,7 @@ pub fn trim_prefix(in: []const u8, prefix: []const u8) []const u8 { |
| 45 | } | 45 | } |
| 46 | | 46 | |
| 47 | pub fn does_file_exist(fpath: []const u8) !bool { | 47 | pub fn does_file_exist(fpath: []const u8) !bool { |
| 48 | const abs_path = std.fs.realpathAlloc(gpa, fpath) catch |e| switch (e) { | 48 | const file = std.fs.cwd().openFile(fpath, .{}) catch |e| switch (e) { |
| 49 | error.FileNotFound => return false, | | |
| 50 | else => return e, | | |
| 51 | }; | | |
| 52 | const file = std.fs.openFileAbsolute(abs_path, .{}) catch |e| switch (e) { | | |
| 53 | error.FileNotFound => return false, | 49 | error.FileNotFound => return false, |
| 54 | else => return e, | 50 | else => return e, |
| 55 | }; | 51 | }; |
| ... | @@ -58,11 +54,10 @@ pub fn does_file_exist(fpath: []const u8) !bool { | ... | @@ -58,11 +54,10 @@ pub fn does_file_exist(fpath: []const u8) !bool { |
| 58 | } | 54 | } |
| 59 | | 55 | |
| 60 | pub fn does_folder_exist(fpath: []const u8) !bool { | 56 | pub fn does_folder_exist(fpath: []const u8) !bool { |
| 61 | const abs_path = std.fs.realpathAlloc(gpa, fpath) catch |e| switch (e) { | 57 | const file = try std.fs.cwd().openFile(abs_path, .{}) catch |e| switch (e) { |
| 62 | error.FileNotFound => return false, | 58 | error.FileNotFound => return false, |
| 63 | else => return e, | 59 | else => return e, |
| 64 | }; | 60 | }; |
| 65 | const file = try std.fs.openFileAbsolute(abs_path, .{}); | | |
| 66 | defer file.close(); | 61 | defer file.close(); |
| 67 | const s = try file.stat(); | 62 | const s = try file.stat(); |
| 68 | if (s.kind != .Directory) { | 63 | if (s.kind != .Directory) { |