authorgravatar for hello@nektro.netMeghan <hello@nektro.net> 2020-11-16 17:58:19 -08:00
committergravatar for hello@nektro.netMeghan <hello@nektro.net> 2020-11-16 17:58:19 -08:00
log98d4a1c3ed812fdd3db3482fe83a77c44cc58e21
treefac3daa7bc2ca13b90a2a1273f1e23ad9bf14ed3
parenta9d103161ba34361432c576c0bed088db2e093fa

util: add another catch case to does_file_exist


1 files changed, 4 insertions(+), 1 deletions(-)

src/util/funcs.zig+4-1
......@@ -41,7 +41,10 @@ pub fn trim_prefix(in: []const u8, prefix: []const u8) []const u8 {
4141}
4242
4343pub fn does_file_exist(fpath: []const u8) !bool {
44 const abs_path = try std.fs.realpathAlloc(gpa, fpath);
44 const abs_path = std.fs.realpathAlloc(gpa, fpath) catch |e| switch (e) {
45 error.FileNotFound => return false,
46 else => return e,
47 };
4548 const file = std.fs.openFileAbsolute(abs_path, .{}) catch |e| switch (e) {
4649 error.FileNotFound => return false,
4750 else => return e,