From d42b15e420478dc45785fff6e00b863cc1f8a0f9 Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Thu, 18 Sep 2008 10:14:53 +0000
Subject: [PATCH] These changes are separating the current delivery into  an "Install Layout" (the binaries) and an "Instance Layout" (the user data).

---
 opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java |   42 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java b/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
index d1064e7..ef3b45d 100644
--- a/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
+++ b/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
@@ -50,6 +50,7 @@
 import org.opends.quicksetup.util.BackgroundTask;
 import org.opends.quicksetup.util.ServerController;
 import org.opends.quicksetup.util.UIKeyStore;
+import org.opends.quicksetup.util.Utils;
 import org.opends.server.admin.AttributeTypePropertyDefinition;
 import org.opends.server.admin.ClassLoaderProvider;
 import org.opends.server.admin.ClassPropertyDefinition;
@@ -586,6 +587,13 @@
   }
 
   /**
+   * {@inheritDoc}
+   */
+  public String getInstancePath() {
+    return getInstancePathFromClasspath(getInstallPathFromClasspath());
+  }
+
+  /**
    * Returns the ApplicationException that might occur during installation or
    * <CODE>null</CODE> if no exception occurred.
    *
@@ -1104,10 +1112,39 @@
       notifyListeners(getFormattedWithPoints(
           INFO_PROGRESS_DELETING_INSTALLATION_FILES_NON_VERBOSE.get()));
     }
-    File f = new File(getInstallPathFromClasspath());
+    String installPath = getInstallPathFromClasspath();
+    File installFile = new File(installPath);
+
+    String instancePath =
+      Utils.getInstancePathFromClasspath(installFile.getAbsolutePath());
+    File instanceFile = new File(instancePath);
+
     InstallationFilesToDeleteFilter filter =
             new InstallationFilesToDeleteFilter();
-    File[] rootFiles = f.listFiles();
+
+    File[] installFiles  = installFile.listFiles();
+    File[] instanceFiles = new File(instancePath).listFiles();
+
+    File[] rootFiles = null;
+
+    if (installFiles == null)
+    {
+      rootFiles = new File(instancePath).listFiles();
+    }
+    else
+    if (instanceFiles == null)
+    {
+      rootFiles = installFiles;
+    }
+    else
+    {
+      // both installFiles and instanceFiles are not null
+      rootFiles = new File[installFiles.length + instanceFiles.length];
+      System.arraycopy(installFiles,  0, rootFiles, 0, installFiles.length);
+      System.arraycopy(instanceFiles, 0, rootFiles, installFiles.length,
+          instanceFiles.length);
+    }
+
     if (rootFiles != null) {
       /* The following is done to have a moving progress bar when we delete
        * the installation files.
@@ -1161,6 +1198,7 @@
                 beforeRatio);
         deleteRecursively(rootFiles[i], filter);
       }
+      deleteRecursively(instanceFile);
       hmRatio.put(UninstallProgressStep.DELETING_INSTALLATION_FILES, maxRatio);
     }
     if (!isVerbose())

--
Gitblit v1.10.0