Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ofLog to ofLogError for error message for non-existing dir #413

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 55 additions & 2 deletions commandLine/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,63 @@ int main(int argc, char ** argv) {
consoleSpace();

// try to get the OF_PATH as an environt variable

char* pPath;
pPath = getenv("PG_OF_PATH");
if (pPath != NULL) {
ofPathEnv = string(pPath);
}

if (ofPath == "" && ofPathEnv != "") {
busingEnvVar = true;
ofPath = ofPathEnv;
}

fs::path projectPath = fs::weakly_canonical(fs::current_path() / projectName);
if (!fs::exists(projectPath)) {
mode = PG_MODE_CREATE;
// FIXME: Maybe it is best not to create anything here, unless specified by parameter
if (!fs::exists(projectPath.parent_path())) {
consoleSpace();
ofLogError() << "Folder doesn't exist " << projectPath.parent_path() << endl;
consoleSpace();
return EXIT_USAGE;

}
fs::create_directory(projectPath);
} else {
mode = PG_MODE_UPDATE;
}


fs::path projectPath = fs::weakly_canonical(fs::current_path() / projectName);
if (ofPath.empty()) {
consoleSpace();
ofLogError() << "no OF path set... please use -o or --ofPath or set a PG_OF_PATH environment variable";
consoleSpace();

//------------------------------------ fix me
//printHelp();
//return

return EXIT_USAGE;
} else {

if (!isGoodOFPath(ofPath)) {
return EXIT_USAGE;
}

// alert ("ofPath before " + ofPath.string());
// alert ("projectPath " + projectPath.string());
if (ofPath.is_relative()) {
ofPath = fs::canonical(fs::current_path() / ofPath);
// alert ("ofPath canonical " + ofPath.string());
}

if (ofIsPathInPath(projectPath, ofPath)) {
ofPath = fs::relative(ofPath, projectPath);
}
fs::current_path(projectPath);
setOFRoot(ofPath);
}
// Verify that projectPath is not root and exists
if (!projectPath.empty() && projectPath != projectPath.root_path() && fs::exists(projectPath)) {
fs::create_directory(projectPath);
Expand Down