Created
January 8, 2015 13:46
-
-
Save ruabmbua/f9eaa38c2f7c8fbb6a6d to your computer and use it in GitHub Desktop.
Cross platform directory exists check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool directoryExists(const std::string &directory) | |
{ | |
if(!directory.empty()) | |
{ | |
if(access(directory.c_str(), 0) == 0) | |
{ | |
struct stat status; | |
stat(directory.c_str(), &status); | |
if(status.st_mode & S_IFDIR) | |
return true; | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment