/** Load and parse the default user/system profile.
 *
 * Load default profile in the following order:
 * - ~/.presage.xml
 * - sysconfdir/presage.xml
 *
 * If no profile is found, a default profile is built and used.
 *
 * @return true if profile is found and successfully loaded, false
 * otherwise.
 *
 */
bool ProfileManager::loadDefaultProfile()
{
    const int PROFILE_SEARCH_PATH_SIZE = 2;
    std::string profile_search_path[PROFILE_SEARCH_PATH_SIZE] = {
        // home dir dotfile
        get_user_home_dir() + '/' + '.' + DEFAULT_PROFILE_FILENAME,
        // installation config directory
	static_cast<std::string>(sysconfdir) + '/' + DEFAULT_PROFILE_FILENAME
    };

    bool readOk = false;

    // try looking for profilename in profile dirs
    int i = 0;
    while(!readOk && i < PROFILE_SEARCH_PATH_SIZE) {
        readOk = loadProfile(profile_search_path[i]);
        i++;
    }

    if (!readOk) {
        // handle failure to load profile
	// highest loglevel, no need to cache this
        logger << ERROR << "No profiles were found. Using default parameters." << endl;
        buildProfile();
    }

    return readOk;
}
Example #2
0
void Path3D::setup(){
    // set the Z axis as the forward axis by default
    makeZForward = true;
    
    ptIndex = 0;
    centroid = ofPoint(.5,.25,.25); // all coordinates are in meters
    reverse = false;
    profile = buildProfile(0.025,4);
    direction = 1;
    feedRate = 0.01;
}