From ecd6711981fbd48a4a9bc376377ba6cc86c0c3fb Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Fri, 13 Apr 2007 15:36:41 +0000
Subject: [PATCH] This commit addresses addresses problems with the file system locking files that arose from testing the upgrader on Windows.

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index fb75387..7c55a5c 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -233,7 +233,15 @@
    * {@inheritDoc}
    */
   protected String getInstallationPath() {
-    return Utils.getInstallPathFromClasspath();
+    // The upgrader runs from the bits extracted by BuildExtractor
+    // in the staging directory.  So 'stagePath' below will point
+    // to the staging directory [installroot]/tmp/upgrade.  However
+    // we still want the Installation to point at the build being
+    // upgraded so the install path reported in [installroot].
+
+    String stagePath = Utils.getInstallPathFromClasspath();
+    File f = new File(stagePath);
+    return Utils.getPath(f.getParentFile().getParentFile());
   }
 
   /**
@@ -924,9 +932,11 @@
       stagingDir = getStageDirectory();
       FileManager fm = new FileManager(this);
 
-      // doing this seems to work betterh than just plain
-      // old delete
-      fm.deleteRecursively(stagingDir);
+      // Doing this seems to work better than just plain
+      // old delete.  Note that on Windows there are file
+      // locking issues to we mark files for deletion after
+      // this JVM exits
+      fm.deleteRecursively(stagingDir, null, /*onExit=*/true);
 
     } catch (IOException e) {
       // TODO i18n

--
Gitblit v1.10.0