Configurations are persistent

This commit is contained in:
4pr0n 2014-04-06 03:39:30 -07:00
parent 311ccca5ee
commit 0863a9328c
4 changed files with 9 additions and 5 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ rips/
ripme.jar.update ripme.jar.update
*.swp *.swp
ripme.jar ripme.jar
rip.properties

View File

@ -111,6 +111,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
} }
public void saveConfig() { public void saveConfig() {
saveHistory();
Utils.setConfigBoolean("file.overwrite", configOverwriteCheckbox.isSelected()); Utils.setConfigBoolean("file.overwrite", configOverwriteCheckbox.isSelected());
Utils.setConfigInteger("threads.size", Integer.parseInt(configThreadsText.getText())); Utils.setConfigInteger("threads.size", Integer.parseInt(configThreadsText.getText()));
Utils.setConfigInteger("download.retries", Integer.parseInt(configRetriesText.getText())); Utils.setConfigInteger("download.retries", Integer.parseInt(configRetriesText.getText()));

View File

@ -34,7 +34,6 @@ public class Utils {
configPath = configFile; configPath = configFile;
} }
config = new PropertiesConfiguration(configPath); config = new PropertiesConfiguration(configPath);
config.setAutoSave(true);
config.setReloadingStrategy(new FileChangedReloadingStrategy()); config.setReloadingStrategy(new FileChangedReloadingStrategy());
logger.info("Loaded " + config.getPath()); logger.info("Loaded " + config.getPath());
} catch (Exception e) { } catch (Exception e) {
@ -93,14 +92,18 @@ public class Utils {
public static void saveConfig() { public static void saveConfig() {
try { try {
config.save(config.getPath()); config.save(getConfigPath());
logger.info("Saved configuration to " + config.getPath()); logger.info("Saved configuration to " + getConfigPath());
} catch (ConfigurationException e) { } catch (ConfigurationException e) {
logger.error("Error while saving configuration: ", e); logger.error("Error while saving configuration: ", e);
} }
} }
private static String getConfigPath() { private static String getConfigPath() {
return configFile; try {
return new File(".").getCanonicalPath() + File.separator + configFile;
} catch (Exception e) {
return "." + File.separator + configFile;
}
} }
/** /**

View File

@ -14,7 +14,6 @@ download.timeout = 60000
# Maximum size of downloaded files in bytes (required) # Maximum size of downloaded files in bytes (required)
download.max_size = 104857600 download.max_size = 104857600
download.history =
# API creds # API creds
twitter.auth = VW9Ybjdjb1pkd2J0U3kwTUh2VXVnOm9GTzVQVzNqM29LQU1xVGhnS3pFZzhKbGVqbXU0c2lHQ3JrUFNNZm8= twitter.auth = VW9Ybjdjb1pkd2J0U3kwTUh2VXVnOm9GTzVQVzNqM29LQU1xVGhnS3pFZzhKbGVqbXU0c2lHQ3JrUFNNZm8=
tumblr.auth = v5kUqGQXUtmF7K0itri1DGtgTs0VQpbSEbh1jxYgj9d2Sq18F8 tumblr.auth = v5kUqGQXUtmF7K0itri1DGtgTs0VQpbSEbh1jxYgj9d2Sq18F8