Skip to content

Instantly share code, notes, and snippets.

@moebiussurfing
Last active May 7, 2020 03:41
Show Gist options
  • Save moebiussurfing/4d3901731ab7c40cc2f3edc4e0eb5ef6 to your computer and use it in GitHub Desktop.
Save moebiussurfing/4d3901731ab7c40cc2f3edc4e0eb5ef6 to your computer and use it in GitHub Desktop.
openFrameworks / check if a data folder is present, create the folder if not.
void ofApp::CheckFolder(string _path)
{
ofDirectory dataDirectory(ofToDataPath(_path, true));
//check if target data folder exist
if (!dataDirectory.isDirectory())
{
ofLogError("__FUNCTION__") << "FOLDER DOES NOT EXIST!";
//create folder
bool b = dataDirectory.createDirectory(ofToDataPath(_path, true));
//debug if creation has been succed
if (b)
ofLogNotice("__FUNCTION__") << "FOLDER '" << _path << "' CREATED SUCCESSFULLY!";
else
ofLogError("__FUNCTION__") << "UNABLE TO CREATE '" << _path << "' FOLDER!";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment