Delete the Felix cache folder on a major or minor version change

cefexperiments 5393
Ingo Bauersachs 12 years ago
parent 99e335d463
commit 5cee50b17e

@ -9,6 +9,7 @@
import java.awt.*;
import java.io.*;
import net.java.sip.communicator.impl.version.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.launchutils.*;
@ -171,11 +172,60 @@ else if (osName.startsWith("Windows"))
}
}
String currentVersion =
VersionImpl.VERSION_MAJOR + "." + VersionImpl.VERSION_MINOR;
File jitsiVersion
= new File(new File(
System.getProperty(PNAME_SC_CACHE_DIR_LOCATION),
System.getProperty(PNAME_SC_HOME_DIR_NAME)),
".lastversion");
if (jitsiVersion.exists())
{
BufferedReader r = new BufferedReader(new FileReader(jitsiVersion));
String lastVersion = r.readLine();
r.close();
if (!currentVersion.equals(lastVersion))
{
File felixCache =
new File(new File(
System.getProperty(PNAME_SC_CACHE_DIR_LOCATION),
System.getProperty(PNAME_SC_HOME_DIR_NAME)),
"sip-communicator.bin");
if (felixCache.exists())
{
deleteRecursive(felixCache);
}
}
}
FileWriter fw = new FileWriter(jitsiVersion);
fw.write(currentVersion);
fw.close();
//there was no error, continue;
System.setOut(new ScStdOut(System.out));
Main.main(new String[0]);
}
/**
* Recursively delete a directory.
* @param f The directory to the delete.
* @throws IOException
*/
private static void deleteRecursive(File f) throws IOException
{
if (f.isDirectory())
{
for (File c : f.listFiles())
{
deleteRecursive(c);
}
}
f.delete();
}
/**
* Sets the system properties net.java.sip.communicator.SC_HOME_DIR_LOCATION
* and net.java.sip.communicator.SC_HOME_DIR_NAME (if they aren't already

Loading…
Cancel
Save