Skip to content

Instantly share code, notes, and snippets.

@GuillaumeLeclerc
Last active August 29, 2015 14:27
Show Gist options
  • Save GuillaumeLeclerc/447bf65199b152ece16d to your computer and use it in GitHub Desktop.
Save GuillaumeLeclerc/447bf65199b152ece16d to your computer and use it in GitHub Desktop.
bool fixed_is_directory(std::string path) {
boost::system::error_code errorCode;
bool result = boost::filesystem::is_directory(path, errorCode);
if (errorCode.value() == 2) {//not found
return false;
} else if (errorCode.value() != 0) {
//this second call will fire the correct exception
boost::filesystem::is_directory(path);
} else {
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment