summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2014-01-22 13:37:14 (EST)
committerPascal Rapicault2014-01-22 13:41:18 (EST)
commite7b87ade409aa48508c70e6eada3c478c56ae7cb (patch)
treec26ed772100cdba6d874a64bb5ba55000f53368b
parent5cd552a378eb59714fc6c77ed609796ac626941c (diff)
downloadrt.equinox.p2-e7b87ade409aa48508c70e6eada3c478c56ae7cb.zip
rt.equinox.p2-e7b87ade409aa48508c70e6eada3c478c56ae7cb.tar.gz
rt.equinox.p2-e7b87ade409aa48508c70e6eada3c478c56ae7cb.tar.bz2
Bug 426388 - Provide fall back mechanism to find migration sourceI20140128-0800I20140123-1600I20140122-2000
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java
index b798159..4bef663 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java
@@ -155,8 +155,34 @@ public class PreviousConfigurationFinder {
if (match == null)
match = findMostRelevantConfigurationFromProductId(potentialConfigurations, runningConfiguration);
if (match == null)
+ match = findSpecifiedConfiguration(searchRoot);
+ if (match == null)
return null;
return AgentFromInstall.createAgentFrom(AutomaticUpdatePlugin.getDefault().getAgentProvider(), null, new File(match.getConfig(), "configuration"), null); //$NON-NLS-1$
+
+ }
+
+ public ConfigurationDescriptor findSpecifiedConfiguration(File searchRoot) {
+ final String prefixesAsString = System.getProperty("p2.forcedMigrationLocation"); //$NON-NLS-1$
+ if (prefixesAsString == null)
+ return null;
+
+ String[] prefixes = prefixesAsString.split(","); //$NON-NLS-1$
+ for (String prefix : prefixes) {
+ final String p = prefix;
+ File[] match = searchRoot.listFiles(new FileFilter() {
+ public boolean accept(File candidate) {
+ if (!candidate.isDirectory())
+ return false;
+ if (currentConfig.equals(candidate))
+ return false;
+ return candidate.getName().contains(p);
+ }
+ });
+ if (match.length != 0)
+ return new ConfigurationDescriptor("unknown", new Identifier("0.0.0"), "unknown", "unknown", match[0]); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
+ }
+ return null;
}
private ConfigurationDescriptor getConfigdataFromProductFile(File installFolder) {