mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@7805 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
committed by
francisco
parent
fe9914978a
commit
f0d13eb9b3
@ -895,7 +895,7 @@ public final class LoginDialog {
|
||||
*/
|
||||
private void checkForOldSettings() throws Exception {
|
||||
// Check for old settings.xml
|
||||
File settingsXML = new File(Spark.getUserHome(), "/Spark/settings.xml");
|
||||
File settingsXML = new File(Spark.getUserSparkHome(), "/settings.xml");
|
||||
if (settingsXML.exists()) {
|
||||
SAXReader saxReader = new SAXReader();
|
||||
Document pluginXML = null;
|
||||
|
||||
@ -40,6 +40,9 @@ import javax.swing.UIManager;
|
||||
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();
|
||||
|
||||
private static String argument;
|
||||
|
||||
private static File RESOURCE_DIRECTORY;
|
||||
@ -75,9 +78,9 @@ public final class Spark {
|
||||
|
||||
final String workingDirectory = System.getProperty("appdir");
|
||||
if (workingDirectory == null) {
|
||||
RESOURCE_DIRECTORY = new File(USER_HOME, "/Spark/resources").getAbsoluteFile();
|
||||
BIN_DIRECTORY = new File(USER_HOME, "/Spark/bin").getAbsoluteFile();
|
||||
LOG_DIRECTORY = new File(USER_HOME, "/Spark/logs").getAbsoluteFile();
|
||||
RESOURCE_DIRECTORY = new File(USER_SPARK_HOME, "/resources").getAbsoluteFile();
|
||||
BIN_DIRECTORY = new File(USER_SPARK_HOME, "/bin").getAbsoluteFile();
|
||||
LOG_DIRECTORY = new File(USER_SPARK_HOME, "/logs").getAbsoluteFile();
|
||||
RESOURCE_DIRECTORY.mkdirs();
|
||||
LOG_DIRECTORY.mkdirs();
|
||||
if (!RESOURCE_DIRECTORY.exists() || !LOG_DIRECTORY.exists()) {
|
||||
@ -95,7 +98,7 @@ public final class Spark {
|
||||
BIN_DIRECTORY = new File(workingDir, "bin").getAbsoluteFile();
|
||||
|
||||
|
||||
LOG_DIRECTORY = new File(USER_HOME, "/Spark/logs").getAbsoluteFile();
|
||||
LOG_DIRECTORY = new File(USER_SPARK_HOME, "/logs").getAbsoluteFile();
|
||||
LOG_DIRECTORY.mkdirs();
|
||||
try {
|
||||
buf.append(RESOURCE_DIRECTORY.getCanonicalPath()).append(";");
|
||||
@ -298,13 +301,22 @@ public final class Spark {
|
||||
|
||||
/**
|
||||
* Returns the User specific directory for this Spark instance. The user home is where all user specific
|
||||
* files are placed to run Spark within a multi-user system.
|
||||
* 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() {
|
||||
return USER_SPARK_HOME;
|
||||
}
|
||||
|
||||
public static boolean isCustomBuild() {
|
||||
return "true".equals(Default.getString("CUSTOM"));
|
||||
@ -352,4 +364,4 @@ public final class Spark {
|
||||
UIManager.put("SparkTabbedPane.endColor", new Color(236, 236, 236));
|
||||
UIManager.put("SparkTabbedPane.borderColor", Color.lightGray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ public final class SparkManager {
|
||||
*/
|
||||
public static File getUserDirectory() {
|
||||
final String bareJID = sessionManager.getBareAddress();
|
||||
File userDirectory = new File(Spark.getUserHome(), "Spark/user/" + bareJID);
|
||||
File userDirectory = new File(Spark.getUserSparkHome(), "/user/" + bareJID);
|
||||
if (!userDirectory.exists()) {
|
||||
userDirectory.mkdirs();
|
||||
}
|
||||
@ -406,4 +406,4 @@ public final class SparkManager {
|
||||
discoManager.removeFeature(namespace);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -665,7 +665,7 @@ public class SparkTransferManager {
|
||||
* @param room the ChatRoom of the user you wish to send the image to.
|
||||
*/
|
||||
public void sendImage(final Image image, final ChatRoom room) {
|
||||
File tmpDirectory = new File(Spark.getUserHome(), "Spark/tempImages");
|
||||
File tmpDirectory = new File(Spark.getUserSparkHome(), "/tempImages");
|
||||
tmpDirectory.mkdirs();
|
||||
|
||||
String imageName = "image_" + StringUtils.randomString(2) + ".png";
|
||||
|
||||
@ -192,7 +192,7 @@ public final class ContactList extends JPanel implements ActionListener, Contact
|
||||
// Load Properties file
|
||||
props = new Properties();
|
||||
// Save to properties file.
|
||||
propertiesFile = new File(new File(Spark.getUserHome(), Spark.getUserConf()), "groups.properties");
|
||||
propertiesFile = new File(Spark.getUserSparkHome() + "/groups.properties");
|
||||
try {
|
||||
props.load(new FileInputStream(propertiesFile));
|
||||
}
|
||||
|
||||
@ -421,7 +421,7 @@ public class TranscriptWindow extends ChatArea {
|
||||
try {
|
||||
SimpleDateFormat formatter;
|
||||
|
||||
File defaultSaveFile = new File(new File(Spark.getUserHome()), fileName);
|
||||
File defaultSaveFile = new File(Spark.getUserSparkHome() + "/" + fileName);
|
||||
final JFileChooser fileChooser = new JFileChooser(defaultSaveFile);
|
||||
fileChooser.setSelectedFile(defaultSaveFile);
|
||||
|
||||
|
||||
@ -146,7 +146,7 @@ public class ReceiveMessage extends JPanel {
|
||||
|
||||
titleLabel.setText(Res.getString("message.user.is.sending.you.a.file", contactItem.getNickname()));
|
||||
|
||||
File tempFile = new File(Spark.getUserHome(), "Spark/tmp");
|
||||
File tempFile = new File(Spark.getUserSparkHome(), "/tmp");
|
||||
try {
|
||||
tempFile.mkdirs();
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ public class LayoutSettingsManager {
|
||||
* @return the settings file.
|
||||
*/
|
||||
public static File getSettingsFile() {
|
||||
File file = new File(Spark.getUserHome(), "Spark");
|
||||
File file = new File(Spark.getUserSparkHome());
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
|
||||
@ -333,7 +333,7 @@ public class SoundPreference implements Preference {
|
||||
}
|
||||
|
||||
private File getSoundSettingsFile() {
|
||||
File file = new File(Spark.getUserHome(), "Spark");
|
||||
File file = new File(Spark.getUserSparkHome());
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public class SettingsManager {
|
||||
* @return the settings file.
|
||||
*/
|
||||
public static File getSettingsFile() {
|
||||
File file = new File(Spark.getUserHome(), "Spark");
|
||||
File file = new File(Spark.getUserSparkHome());
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user