#How to check if a path is file, dir or does not exist cross platform?
1 messages · Page 1 of 1 (latest)
the only good way to check is to try to open the file and catch error.FileNotFound
there’s also an error for trying to open a directory but I forgot what it’s called
probably error.IsDir or something
I've seen an issue that suggests I can't rely on the error.IsDir on all platforms. https://github.com/ziglang/zig/issues/5732
Although I read a bit about it I had hoped to be able to avoid to dive into the details (and testing on different OS) and "just" get a solution that works on the 3 mentioned OS.
Reading a bit more in those issues it looks like the current state is that it's not there yet but talked about/planned.
Thank you. Do you know why error.AccessDenied also calls fmtPathDir?
I assume that's the error you get on windows when you try to open a dir as a file