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
*.swp
ripme.jar
rip.properties

View File

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

View File

@ -34,7 +34,6 @@ public class Utils {
configPath = configFile;
}
config = new PropertiesConfiguration(configPath);
config.setAutoSave(true);
config.setReloadingStrategy(new FileChangedReloadingStrategy());
logger.info("Loaded " + config.getPath());
} catch (Exception e) {
@ -93,14 +92,18 @@ public class Utils {
public static void saveConfig() {
try {
config.save(config.getPath());
logger.info("Saved configuration to " + config.getPath());
config.save(getConfigPath());
logger.info("Saved configuration to " + getConfigPath());
} catch (ConfigurationException e) {
logger.error("Error while saving configuration: ", e);
}
}
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)
download.max_size = 104857600
download.history =
# API creds
twitter.auth = VW9Ybjdjb1pkd2J0U3kwTUh2VXVnOm9GTzVQVzNqM29LQU1xVGhnS3pFZzhKbGVqbXU0c2lHQ3JrUFNNZm8=
tumblr.auth = v5kUqGQXUtmF7K0itri1DGtgTs0VQpbSEbh1jxYgj9d2Sq18F8