- public boolean handleBaselineDatabase() throws PlatformException {
- Path workspaceLocation = Platform.getLocation().toFile().toPath();
- Path baselineIndicatorFile = workspaceLocation.resolve(".baselined");
- if (Files.isRegularFile(baselineIndicatorFile)) {
- // This means that the workspace has already been initialized from
- // a database baseline and further initialization is not necessary.
- return true;
- }
-
- String dbBaselineArchive = System.getProperty("org.simantics.db.baseline", null);
- if (dbBaselineArchive == null)
- return false;
-
- Path baseline = Paths.get(dbBaselineArchive);
- if (!Files.isRegularFile(baseline))
- throw new PlatformException("Specified database baseline archive " + baseline + " does not exist. Cannot initialize workspace database.");
+ private static Path tryGetInstallLocation() {
+ Location l = Platform.getInstallLocation();
+ return l == null ? null : new File(l.getURL().getPath()).toPath();
+ }