From b7eaa6fa023b868aa8154610c05801a94ed0afea Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 05 Jan 2007 14:04:45 +0000
Subject: [PATCH] 

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

diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index b416de1..2d989e3 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -72,6 +72,8 @@
 {
   private static final int BUFFER_SIZE = 1024;
 
+  private static final int MAX_LINE_WIDTH = 80;
+
   private static final String[] OPEN_DS_JAR_RELATIVE_PATHS =
     { "lib/quicksetup.jar", "lib/OpenDS.jar", "lib/je.jar" };
 
@@ -950,6 +952,8 @@
    */
   public static String getInstallPathFromClasspath()
   {
+    String installPath;
+
     /* Get the install path from the Class Path */
     String sep = System.getProperty("path.separator");
     String[] classPaths = System.getProperty("java.class.path").split(sep);
@@ -969,7 +973,20 @@
     File f = new File(path).getAbsoluteFile();
     File binariesDir = f.getParentFile();
 
-    return binariesDir.getParent();
+    /*
+     * Do a best effort to avoid having a relative representation (for
+     * instance to avoid having ../../../).
+     */
+    try
+    {
+      installPath = binariesDir.getParentFile().getCanonicalPath();
+    }
+    catch (IOException ioe)
+    {
+      // Best effort
+      installPath = binariesDir.getParent();
+    }
+    return installPath;
   }
 
   /**
@@ -1310,4 +1327,15 @@
     }
     return (InitialLdapContext) pair[0];
   }
+
+  /**
+   * Returns the max size in character of a line to be displayed in the command
+   * line.
+   * @return the max size in character of a line to be displayed in the command
+   * line.
+   */
+  public static int getCommandLineMaxLineWidth()
+  {
+    return MAX_LINE_WIDTH;
+  }
 }

--
Gitblit v1.10.0