#Checking if a File or Directory actually exists

1 messages · Page 1 of 1 (latest)

glad mango
#

If I specifically want to resolve a File or a Directory and do something different depending on whether or not it's there, what's the right way to do that? It seems like for File I could do .Contents() and catch errors, but not sure if that's the intended flow.

glad mango
#

Related question: how could I check whether a path inside a Directory points to a File or a Directory,?

glad mango
#

I'd still much prefer a native way to do it in the API, though

kindred patio
#

I think we could expose a Stat call for this - all the code is there already internally. would you mind opening an issue? 🙂

#

could be something like Directory { stat(path: String) } and File { stat }

glad mango