From f2fe5c04dd8722297ec97b2737ec8812ffd5ad73 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 16 Mar 2007 09:44:16 +0000
Subject: [PATCH] Fix for issue 1252 (restrict installed bin files to relevant platform).

---
 opends/src/quicksetup/org/opends/quicksetup/util/Utils.java |   59 +++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 49 insertions(+), 10 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index b442baa..b0f4d75 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -73,10 +73,16 @@
   private static final String[] OPEN_DS_JAR_RELATIVE_PATHS =
     { "lib/quicksetup.jar", "lib/OpenDS.jar", "lib/je.jar" };
 
+
   /**
-   * The relative path where all the binaries (scripts) are.
+   * The relative path where all the Windows binaries (batch files) are.
    */
-  private static final String BINARIES_PATH_RELATIVE = "bin";
+  private static final String WINDOWS_BINARIES_PATH_RELATIVE = "bat";
+
+  /**
+   * The relative path where all the UNIX binaries (scripts) are.
+   */
+  private static final String UNIX_BINARIES_PATH_RELATIVE = "bin";
 
   /**
    * The relative path where all the libraries (jar files) are.
@@ -964,7 +970,7 @@
       }
     }
     File f = new File(path).getAbsoluteFile();
-    File binariesDir = f.getParentFile();
+    File librariesDir = f.getParentFile();
 
     /*
      * Do a best effort to avoid having a relative representation (for
@@ -972,12 +978,12 @@
      */
     try
     {
-      installPath = binariesDir.getParentFile().getCanonicalPath();
+      installPath = librariesDir.getParentFile().getCanonicalPath();
     }
     catch (IOException ioe)
     {
       // Best effort
-      installPath = binariesDir.getParent();
+      installPath = librariesDir.getParent();
     }
     return installPath;
   }
@@ -1005,14 +1011,47 @@
 
 
   /**
-   * Returns the relative path of the directory containing the binaries of the
-   * Open DS installation.  The path is relative to the installation path.
-   * @return the relative path of the directory containing the binaries of the
-   * Open DS installation.
+   * Returns the relative path of the directory containing the Windows binaries
+   * of the Open DS installation.  The path is relative to the installation
+   * path.
+   * @return the relative path of the directory containing the Windows binaries
+   * of the Open DS installation.
+   */
+  public static String getWindowsBinariesRelativePath()
+  {
+    return WINDOWS_BINARIES_PATH_RELATIVE;
+  }
+
+  /**
+   * Returns the relative path of the directory containing the binaries/scripts
+   * of the Open DS installation.  The path is relative to the installation
+   * path.
+   * @return the relative path of the directory containing the binaries/scripts
+   * of the Open DS installation.
    */
   public static String getBinariesRelativePath()
   {
-    return BINARIES_PATH_RELATIVE;
+    String binPath;
+    if (isWindows())
+    {
+      binPath = getWindowsBinariesRelativePath();
+    }
+    else
+    {
+      binPath = getUNIXBinariesRelativePath();
+    }
+    return binPath;
+  }
+
+  /**
+   * Returns the relative path of the directory containing the UNIX binaries of
+   * the Open DS installation.  The path is relative to the installation path.
+   * @return the relative path of the directory containing the UNIX binaries of
+   * the Open DS installation.
+   */
+  public static String getUNIXBinariesRelativePath()
+  {
+    return UNIX_BINARIES_PATH_RELATIVE;
   }
 
   /**

--
Gitblit v1.10.0