aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/launcher/SIPCommunicator.java
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2012-07-06 14:23:49 +0000
committerDamian Minkov <damencho@jitsi.org>2012-07-06 14:23:49 +0000
commitf681befc831bb3f77d8fb054cd6962e0ae417c00 (patch)
treefffe63de42af692e09d261d6bb24f999fc38c0df /src/net/java/sip/communicator/launcher/SIPCommunicator.java
parent68ffd1ba544f4778c7c35658760bf353dff2f4ae (diff)
downloadjitsi-f681befc831bb3f77d8fb054cd6962e0ae417c00.zip
jitsi-f681befc831bb3f77d8fb054cd6962e0ae417c00.tar.gz
jitsi-f681befc831bb3f77d8fb054cd6962e0ae417c00.tar.bz2
Fixes update problem for old home folders under macosx.
Diffstat (limited to 'src/net/java/sip/communicator/launcher/SIPCommunicator.java')
-rw-r--r--src/net/java/sip/communicator/launcher/SIPCommunicator.java49
1 files changed, 45 insertions, 4 deletions
diff --git a/src/net/java/sip/communicator/launcher/SIPCommunicator.java b/src/net/java/sip/communicator/launcher/SIPCommunicator.java
index 72e18dd..3b81128 100644
--- a/src/net/java/sip/communicator/launcher/SIPCommunicator.java
+++ b/src/net/java/sip/communicator/launcher/SIPCommunicator.java
@@ -43,12 +43,19 @@ public class SIPCommunicator
/**
* Legacy home directory names that we can use if current dir name
- * is the crrently active name (overridableDirName).
+ * is the currently active name (overridableDirName).
*/
private static String[] legacyDirNames =
{".sip-communicator", "SIP Communicator"};
/**
+ * Name of the possible configuration file names (used under macosx).
+ */
+ private static String[] legacyConfigurationFileNames =
+ {"sip-communicator.properties", "jitsi.properties",
+ "sip-communicator.xml", "jitsi.xml"};
+
+ /**
* Starts the SIP Communicator.
*
* @param args command line args if any
@@ -230,21 +237,23 @@ public class SIPCommunicator
// if we need to check legacy names and there is no
// current home dir already created
if(chekLegacyDirNames
- && !new File(location, name).isDirectory())
+ && !checkHomeFolderExist(location, name, osName))
{
// now check whether some of the legacy dir names
// exists, and use it if exist
for(int i = 0; i < legacyDirNames.length; i++)
{
// check the platform specific directory
- if(new File(location, legacyDirNames[i]).isDirectory())
+ if(checkHomeFolderExist(
+ location, legacyDirNames[i], osName))
{
name = legacyDirNames[i];
break;
}
// now check it and in the default location
- if(new File(defaultLocation, legacyDirNames[i]).isDirectory())
+ if(checkHomeFolderExist(
+ defaultLocation, legacyDirNames[i], osName))
{
name = legacyDirNames[i];
location = defaultLocation;
@@ -262,6 +271,38 @@ public class SIPCommunicator
}
/**
+ * Checks whether home folder exists.
+ * Special situation checked under macosx, due to created folder
+ * of the new version of the updater we may end up with our
+ * settings in 'SIP Communicator' folder and having 'Jitsi' folder
+ * created by the updater(its download location).
+ * So we check not only the folder exist but whether it contains
+ * any of the known configuration files in it.
+ *
+ * @param parent the parent folder
+ * @param name the folder name to check.
+ * @param osName OS name
+ * @return whether folder exists.
+ */
+ static boolean checkHomeFolderExist(
+ String parent, String name, String osName)
+ {
+ if(osName.startsWith("Mac"))
+ {
+ for(int i = 0; i < legacyConfigurationFileNames.length; i++)
+ {
+ if(new File(new File(parent, name)
+ , legacyConfigurationFileNames[i]).exists())
+ return true;
+ }
+
+ return false;
+ }
+
+ return new File(parent, name).isDirectory();
+ }
+
+ /**
* Sets some system properties specific to the OS that needs to be set at
* the very beginning of a program (typically for UI related properties,
* before AWT is launched).