authorgravatar for hello@nektro.netMeghan <hello@nektro.net> 2020-12-28 19:20:17 -08:00
committergravatar for hello@nektro.netMeghan <hello@nektro.net> 2020-12-28 19:20:17 -08:00
logeb51846d3ea24cc4821aef12952cfdfe54b6a191
tree71d58739c0ab47bbb54d4c70af7bdee40a46ff0c
parent79462250252016b0e3128c3c10056b0e394a8253

fix error that was arising on windows, fixes #7


1 files changed, 2 insertions(+), 0 deletions(-)

src/util/funcs.zig+2
...@@ -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 {
49pub fn does_file_exist(fpath: []const u8) !bool {49pub 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 {
58pub fn does_folder_exist(fpath: []const u8) !bool {59pub 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();