Delete the settings file if the user does not want to save its info

This commit is contained in:
Laurent Clouet
2015-04-02 20:31:16 +01:00
parent 901fab65f2
commit 56fb084afa
2 changed files with 12 additions and 0 deletions

View File

@@ -49,6 +49,10 @@ public class SettingsLoader {
path = System.getProperty("user.home") + File.separator + ".sheepit.conf";
}
public String getFilePath() {
return path;
}
public void saveFile() {
Properties prop = new Properties();
OutputStream output = null;

View File

@@ -3,6 +3,7 @@ package com.sheepit.client.standalone.swing.activity;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
@@ -270,6 +271,13 @@ public class Settings implements Activity {
if (saveFile.isSelected()) {
new SettingsLoader(login.getText(), new String(password.getPassword()), method, selected_gpu, cachePath).saveFile();
}
else {
try {
new File(new SettingsLoader().getFilePath()).delete();
}
catch (SecurityException e3) {
}
}
}
}