Swift development tips and experiences by Tommi Kivimäki

Browse all notes

How to check if directory exist using Swift in Linux

The current version of Foundation on Linux does not have the fileExists(atPath:isDirectory:) method. I target a lot of my Swift code to run on Linux containers. Checking if a directory exists is something that I need often when handling files.

I created a small helper function in C, which is available on Github.