Example usage for org.apache.commons.configuration PropertiesConfiguration setPath

List of usage examples for org.apache.commons.configuration PropertiesConfiguration setPath

Introduction

In this page you can find the example usage for org.apache.commons.configuration PropertiesConfiguration setPath.

Prototype

public void setPath(String path) 

Source Link

Document

Sets the location of this configuration as a full or relative path name.

Usage

From source file:tagtime.settings.Settings.java

/**
 * Creates a new settings manager for the given user.
 *//*from  w  ww  .j av a2  s.  c  om*/
private Settings(String userName) {
    //setup
    this.username = userName;
    //settingValues = new EnumMap<SettingType, Object>(SettingType.class);

    String fileLocation = Main.getDataDirectory().getPath() + "/" + userName + ".properties";

    //load the file
    PropertiesConfiguration tempProperties;
    try {
        tempProperties = new PropertiesConfiguration(fileLocation);
    } catch (ConfigurationException e) {
        //file not found
        tempProperties = new PropertiesConfiguration();

        tempProperties.setPath(fileLocation);
        try {
            tempProperties.save();
        } catch (ConfigurationException e1) {
            e1.printStackTrace();
        }
    }

    properties = tempProperties;

    /*if(settingsFile.exists()) {
       //read the save file and load the settings
       BufferedReader in = new BufferedReader(new FileReader(settingsFile));
       readInSettings(in);
               
       //TagTime doesn't bother reading the file from here on; if the
       //user changes it, those changes will be overwritten
       in.close();
    } else {
       applyDefaultSettings();
       flush();
    }*/
}