I am working on a C # console application that should work on both Windows and Linux. It will work on .NET 3.5 and Mono. I would like to be able to check if a directory exists inside the current directory. Since Windows uses a backslash to traverse a directory, and Linux uses a backslash, how can I check if a directory exists in another directory?
I am using System.IO.Directory.Exists. I think an easy way to do this is to first check the current working folder for "/" or "\" to determine which one to use, however in some cases there may be an escape character that will ruin everything!
source share