Minor refactoring.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@9014 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2007-08-27 23:37:53 +00:00
committed by derek
parent 877a2889c0
commit 3b484b0919
10 changed files with 16 additions and 23 deletions

View File

@ -1103,7 +1103,7 @@ public final class LoginDialog {
*/
private void checkForOldSettings() throws Exception {
// Check for old settings.xml
File settingsXML = new File(Spark.getUserSparkHome(), "/settings.xml");
File settingsXML = new File(Spark.getSparkUserHome(), "/settings.xml");
if (settingsXML.exists()) {
SAXReader saxReader = new SAXReader();
Document pluginXML = null;

View File

@ -37,8 +37,6 @@ import java.io.IOException;
*/
public final class Spark {
private static final String USER_HOME = System.getProperties().getProperty("user.home");
private static final String USER_SPARK_HOME = System.getProperties().getProperty("user.home") + "/" + getUserConf();
public static String ARGUMENTS;
@ -285,30 +283,25 @@ public final class Spark {
*
* @return Directory name depending on Operating System.
*/
public static String getUserConf() {
private static String getUserConf() {
if (isLinux()) {
return ".Spark";
}
else if(isWindows()){
return "Spark";
}
return "Spark";
}
/**
* Returns the User specific directory for this Spark instance. The user home is where all user specific
* files are placed.
*
* @return the user home;
*/
public static String getUserHome() {
return USER_HOME;
}
/**
* Returns the Spark directory for the current user (user.home). The user home is where all user specific
* files are placed to run Spark within a multi-user system.
*
* @return the user home / Spark;
*/
public static String getUserSparkHome() {
public static String getSparkUserHome() {
return USER_SPARK_HOME;
}

View File

@ -351,7 +351,7 @@ public final class SparkManager {
*/
public static File getUserDirectory() {
final String bareJID = sessionManager.getBareAddress();
File userDirectory = new File(Spark.getUserSparkHome(), "/user/" + bareJID);
File userDirectory = new File(Spark.getSparkUserHome(), "/user/" + bareJID);
if (!userDirectory.exists()) {
userDirectory.mkdirs();
}

View File

@ -694,7 +694,7 @@ public class SparkTransferManager {
* @param room the ChatRoom of the user you wish to send the image to.
*/
public void sendImage(final BufferedImage image, final ChatRoom room) {
File tmpDirectory = new File(Spark.getUserSparkHome(), "/tempImages");
File tmpDirectory = new File(Spark.getSparkUserHome(), "/tempImages");
tmpDirectory.mkdirs();
String imageName = "image_" + StringUtils.randomString(2) + ".png";

View File

@ -196,7 +196,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
// Load Properties file
props = new Properties();
// Save to properties file.
propertiesFile = new File(Spark.getUserSparkHome() + "/groups.properties");
propertiesFile = new File(Spark.getSparkUserHome() + "/groups.properties");
try {
props.load(new FileInputStream(propertiesFile));
}

View File

@ -430,7 +430,7 @@ public class TranscriptWindow extends ChatArea {
try {
SimpleDateFormat formatter;
File defaultSaveFile = new File(Spark.getUserSparkHome() + "/" + fileName);
File defaultSaveFile = new File(Spark.getSparkUserHome() + "/" + fileName);
final JFileChooser fileChooser = new JFileChooser(defaultSaveFile);
fileChooser.setSelectedFile(defaultSaveFile);

View File

@ -144,7 +144,7 @@ public class ReceiveMessage extends JPanel {
titleLabel.setText(Res.getString("message.user.is.sending.you.a.file", contactItem.getNickname()));
File tempFile = new File(Spark.getUserSparkHome(), "/tmp");
File tempFile = new File(Spark.getSparkUserHome(), "/tmp");
try {
tempFile.mkdirs();

View File

@ -98,7 +98,7 @@ public class LayoutSettingsManager {
* @return the settings file.
*/
public static File getSettingsFile() {
File file = new File(Spark.getUserSparkHome());
File file = new File(Spark.getSparkUserHome());
if (!file.exists()) {
file.mkdirs();
}

View File

@ -333,7 +333,7 @@ public class SoundPreference implements Preference {
}
private File getSoundSettingsFile() {
File file = new File(Spark.getUserSparkHome());
File file = new File(Spark.getSparkUserHome());
if (!file.exists()) {
file.mkdirs();
}

View File

@ -85,7 +85,7 @@ public class SettingsManager {
* @return the settings file.
*/
public static File getSettingsFile() {
File file = new File(Spark.getUserSparkHome());
File file = new File(Spark.getSparkUserHome());
if (!file.exists()) {
file.mkdirs();
}