dont migrate clients.config if portable

This commit is contained in:
zzz
2019-06-05 12:08:01 +00:00
parent 38f135ceb9
commit 0d1dbc7992

View File

@ -92,7 +92,7 @@ public class ClientAppConfig {
public final String stopargs; public final String stopargs;
/** @since 0.7.12 */ /** @since 0.7.12 */
public final String uninstallargs; public final String uninstallargs;
/** @since 0.0.34 */ /** @since 0.9.42 */
private File configFile; private File configFile;
public ClientAppConfig(String cl, String client, String a, long d, boolean dis) { public ClientAppConfig(String cl, String client, String a, long d, boolean dis) {
@ -190,9 +190,14 @@ public class ClientAppConfig {
* Migrate apps from file to individual files in dir * Migrate apps from file to individual files in dir
* *
* @return success * @return success
* @since 0.9.34 * @since 0.9.42
*/ */
private static boolean migrate(I2PAppContext ctx, List<ClientAppConfig> apps, File from, File dir) { private static boolean migrate(I2PAppContext ctx, List<ClientAppConfig> apps, File from, File dir) {
// don't migrate portable
try {
if (ctx.getConfigDir().getCanonicalPath().equals(ctx.getBaseDir().getCanonicalPath()))
return false;
} catch (IOException ioe) {}
if (!dir.isDirectory() && !dir.mkdirs()) if (!dir.isDirectory() && !dir.mkdirs())
return false; return false;
boolean ok = true; boolean ok = true;
@ -242,7 +247,7 @@ public class ClientAppConfig {
* with this prefix * with this prefix
* *
* @return null if none * @return null if none
* @since 0.9.34 split out from above * @since 0.9.42 split out from above
*/ */
private static ClientAppConfig getClientApp(Properties clientApps, String prefix) { private static ClientAppConfig getClientApp(Properties clientApps, String prefix) {
String className = clientApps.getProperty(prefix + ".main"); String className = clientApps.getProperty(prefix + ".main");
@ -283,7 +288,7 @@ public class ClientAppConfig {
* Do not use if multiple apps in a single file - use writeClientAppConfig(ctx, apps). * Do not use if multiple apps in a single file - use writeClientAppConfig(ctx, apps).
* If app.configFile is null, a new file will be created and assigned. * If app.configFile is null, a new file will be created and assigned.
* *
* @since 0.9.34 * @since 0.9.42
*/ */
public synchronized static void writeClientAppConfig(I2PAppContext ctx, ClientAppConfig app) throws IOException { public synchronized static void writeClientAppConfig(I2PAppContext ctx, ClientAppConfig app) throws IOException {
if (app.configFile == null) { if (app.configFile == null) {
@ -313,7 +318,7 @@ public class ClientAppConfig {
* Do not add apps with this method - use writeClientAppConfig(ctx, app). * Do not add apps with this method - use writeClientAppConfig(ctx, app).
* Do not delete apps with this method - use deleteClientAppConfig(). * Do not delete apps with this method - use deleteClientAppConfig().
* *
* @since 0.9.34 split out from above * @since 0.9.42 split out from above
*/ */
public synchronized static void writeClientAppConfig(I2PAppContext ctx, List<ClientAppConfig> apps) throws IOException { public synchronized static void writeClientAppConfig(I2PAppContext ctx, List<ClientAppConfig> apps) throws IOException {
// Gather the set of config files // Gather the set of config files
@ -350,7 +355,7 @@ public class ClientAppConfig {
* All to a single file, apps.configFile ignored * All to a single file, apps.configFile ignored
* *
* @throws IllegalArgumentException if null cfgFile * @throws IllegalArgumentException if null cfgFile
* @since 0.9.34 split out from above * @since 0.9.42 split out from above
*/ */
private static void writeClientAppConfig(List<ClientAppConfig> apps, File cfgFile) throws IOException { private static void writeClientAppConfig(List<ClientAppConfig> apps, File cfgFile) throws IOException {
if (cfgFile == null) if (cfgFile == null)
@ -372,7 +377,7 @@ public class ClientAppConfig {
/** /**
* @return success * @return success
* @throws IllegalArgumentException if cac has a null configfile * @throws IllegalArgumentException if cac has a null configfile
* @since 0.9.34 * @since 0.9.42
*/ */
public synchronized static boolean deleteClientAppConfig(ClientAppConfig cac) throws IOException { public synchronized static boolean deleteClientAppConfig(ClientAppConfig cac) throws IOException {
File f = cac.configFile; File f = cac.configFile;
@ -389,7 +394,7 @@ public class ClientAppConfig {
} }
/** /**
* @since 0.9.34 * @since 0.9.42
*/ */
@Override @Override
public int hashCode() { public int hashCode() {
@ -398,7 +403,7 @@ public class ClientAppConfig {
/** /**
* Matches on class, args, and name only * Matches on class, args, and name only
* @since 0.9.34 * @since 0.9.42
*/ */
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {