| ... | @@ -49,6 +49,7 @@ pub fn trim_prefix(in: []const u8, prefix: []const u8) []const u8 { | ... | @@ -49,6 +49,7 @@ pub fn trim_prefix(in: []const u8, prefix: []const u8) []const u8 { |
| 49 | pub fn does_file_exist(fpath: []const u8) !bool { | 49 | pub fn does_file_exist(fpath: []const u8) !bool { |
| 50 | const file = std.fs.cwd().openFile(fpath, .{}) catch |e| switch (e) { | 50 | const file = std.fs.cwd().openFile(fpath, .{}) catch |e| switch (e) { |
| 51 | error.FileNotFound => return false, | 51 | error.FileNotFound => return false, |
| | 52 | error.IsDir => return true, |
| 52 | else => return e, | 53 | else => return e, |
| 53 | }; | 54 | }; |
| 54 | defer file.close(); | 55 | defer file.close(); |
| ... | @@ -58,6 +59,7 @@ pub fn does_file_exist(fpath: []const u8) !bool { | ... | @@ -58,6 +59,7 @@ pub fn does_file_exist(fpath: []const u8) !bool { |
| 58 | pub fn does_folder_exist(fpath: []const u8) !bool { | 59 | pub fn does_folder_exist(fpath: []const u8) !bool { |
| 59 | const file = std.fs.cwd().openFile(fpath, .{}) catch |e| switch (e) { | 60 | const file = std.fs.cwd().openFile(fpath, .{}) catch |e| switch (e) { |
| 60 | error.FileNotFound => return false, | 61 | error.FileNotFound => return false, |
| | 62 | error.IsDir => return true, |
| 61 | else => return e, | 63 | else => return e, |
| 62 | }; | 64 | }; |
| 63 | defer file.close(); | 65 | defer file.close(); |