create a folder

does anyone have cross platform (windows + mac) code to check if a folder exists, and create it if it doesn’t?

Linux has the stat function in <sys/stat.h> which I believe exists on the other platforms as well:

http://www.techbytes.ca/techbyte103.html
http://developer.apple.com/mac/library/-…-tat.2.html
http://msdn.microsoft.com/en-us/library/14h5k7ff(VS.80.aspx

How about this:

A file helper class that I made for the Portrait Machine project - uses poco internally.

static bool copyFromTo(string pathSrc, string pathDst, bool bRelativeToData = true, bool overwrite = false);
static bool moveFromTo(string pathSrc, string pathDst, bool bRelativeToData = true, bool overwrite = false)
static string getFileExt(string filename);
static string removeExt(string filename);
static string prependBackslash(string path);
static string appendBackslash(string path);
static bool doesDirectoryExist(string dirPath, bool bRelativeToData = true);
static bool doesFileExist(string fPath, bool bRelativeToData = true);
static bool makeDirectory(string dirPath, bool bRelativeToData = true);
static bool deleteFile(string path, bool bRelativeToData = true)
static bool deleteFolder(string path, bool bRelativeToData = true)

fileHelper.h.zip