From 4dc4c537142907a8f80f34845839751ed4422b9e Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Wed, 25 Jul 2007 04:00:20 +0000
Subject: [PATCH] Use work-around for long filename bug in Windows 2000. Issue #1985.

---
 opends/resource/bin/stop-ds.bat            |    2 
 opends/resource/bin/_server-script.bat     |    3 -
 opends/resource/bin/list-backends.bat      |    3 +
 opends/resource/bin/status-panel.bat       |    2 
 opends/resource/bin/restore.bat            |    3 +
 opends/resource/bin/make-ldif.bat          |    2 
 opends/resource/bin/_client-script.bat     |    3 -
 opends/resource/bin/status.bat             |    2 
 opends/resource/bin/backup.bat             |    2 
 opends/resource/bin/manage-account.bat     |    3 +
 opends/resource/bin/dsconfig.bat           |    2 
 opends/resource/bin/ldifmodify.bat         |    2 
 opends/resource/bin/ldapmodify.bat         |    2 
 opends/resource/bin/ldif-diff.bat          |    3 +
 opends/resource/bin/start-ds.bat           |    3 +
 opends/resource/upgrade.bat                |    2 
 opends/resource/bin/dsframework.bat        |    2 
 opends/resource/bin/windows-service.bat    |    2 
 opends/resource/bin/export-ldif.bat        |    2 
 opends/resource/bin/encode-password.bat    |    2 
 opends/resource/bin/ldifsearch.bat         |    2 
 opends/resource/bin/ldappasswordmodify.bat |    2 
 opends/resource/bin/ldapcompare.bat        |    2 
 opends/resource/bin/configure-ds.bat       |    2 
 opends/resource/setup.bat                  |    7 ++-
 opends/resource/bin/rebuild-index.bat      |    3 +
 opends/resource/bin/verify-index.bat       |    3 +
 opends/resource/bin/ldapdelete.bat         |    2 
 opends/resource/bin/import-ldif.bat        |    2 
 opends/resource/uninstall.bat              |    2 
 opends/resource/bin/ldapsearch.bat         |    2 
 31 files changed, 42 insertions(+), 34 deletions(-)

diff --git a/opends/resource/bin/_client-script.bat b/opends/resource/bin/_client-script.bat
index 343eaeb..5dc4b9b 100644
--- a/opends/resource/bin/_client-script.bat
+++ b/opends/resource/bin/_client-script.bat
@@ -29,8 +29,7 @@
 rem be invoked directly by end users.
 
 setlocal
-
-set DIR_HOME=%~dP0..
+for %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
 set INSTANCE_ROOT=%DIR_HOME%
 
 if "%OPENDS_INVOKE_CLASS%" == "" goto noInvokeClass
diff --git a/opends/resource/bin/_server-script.bat b/opends/resource/bin/_server-script.bat
index d57b5c1..eded04d 100644
--- a/opends/resource/bin/_server-script.bat
+++ b/opends/resource/bin/_server-script.bat
@@ -29,8 +29,7 @@
 rem be invoked directly by end users.
 
 setlocal
-
-set DIR_HOME=%~dP0..
+for %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
 set INSTANCE_ROOT=%DIR_HOME%
 
 if "%OPENDS_INVOKE_CLASS%" == "" goto noInvokeClass
diff --git a/opends/resource/bin/backup.bat b/opends/resource/bin/backup.bat
index 85748bb..44c4c5c 100644
--- a/opends/resource/bin/backup.bat
+++ b/opends/resource/bin/backup.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.BackUpDB"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=backup"
-call "%~dP0\..\lib\_server-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_server-script.bat" %*
 
diff --git a/opends/resource/bin/configure-ds.bat b/opends/resource/bin/configure-ds.bat
index 2992fe9..1d001cd 100644
--- a/opends/resource/bin/configure-ds.bat
+++ b/opends/resource/bin/configure-ds.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.ConfigureDS"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=configure-ds"
-call "%~dP0\..\lib\_server-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_server-script.bat" %*
 
diff --git a/opends/resource/bin/dsconfig.bat b/opends/resource/bin/dsconfig.bat
index d2ea99f..0ce932b 100644
--- a/opends/resource/bin/dsconfig.bat
+++ b/opends/resource/bin/dsconfig.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.dsconfig.DSConfig"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=dsconfig"
-call "%~dP0\..\lib\_client-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %*
 
diff --git a/opends/resource/bin/dsframework.bat b/opends/resource/bin/dsframework.bat
index 02c97fa..78dfd0f 100644
--- a/opends/resource/bin/dsframework.bat
+++ b/opends/resource/bin/dsframework.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.admin.client.cli.DsFrameworkCliMain"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=dsframework"
-call "%~dP0\..\lib\_client-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %*
 
diff --git a/opends/resource/bin/encode-password.bat b/opends/resource/bin/encode-password.bat
index 34c0143..168e324 100644
--- a/opends/resource/bin/encode-password.bat
+++ b/opends/resource/bin/encode-password.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.EncodePassword"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=encode-password"
-call "%~dP0\..\lib\_server-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_server-script.bat" %*
 
diff --git a/opends/resource/bin/export-ldif.bat b/opends/resource/bin/export-ldif.bat
index 9e2cdcc..e85aaaa 100644
--- a/opends/resource/bin/export-ldif.bat
+++ b/opends/resource/bin/export-ldif.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.ExportLDIF"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=export-ldif"
-call "%~dP0\..\lib\_server-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_server-script.bat" %*
 
diff --git a/opends/resource/bin/import-ldif.bat b/opends/resource/bin/import-ldif.bat
index 740e735..d2000e8 100644
--- a/opends/resource/bin/import-ldif.bat
+++ b/opends/resource/bin/import-ldif.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.ImportLDIF"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=import-ldif"
-call "%~dP0\..\lib\_server-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_server-script.bat" %*
 
diff --git a/opends/resource/bin/ldapcompare.bat b/opends/resource/bin/ldapcompare.bat
index 9a2b78a..7b91fd3 100644
--- a/opends/resource/bin/ldapcompare.bat
+++ b/opends/resource/bin/ldapcompare.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDAPCompare"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=ldapcompare"
-call "%~dP0\..\lib\_client-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %*
 
diff --git a/opends/resource/bin/ldapdelete.bat b/opends/resource/bin/ldapdelete.bat
index 54af183..53d63b8 100644
--- a/opends/resource/bin/ldapdelete.bat
+++ b/opends/resource/bin/ldapdelete.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDAPDelete"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=ldapdelete"
-call "%~dP0\..\lib\_client-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %*
 
diff --git a/opends/resource/bin/ldapmodify.bat b/opends/resource/bin/ldapmodify.bat
index fca9c92..0297aa6 100644
--- a/opends/resource/bin/ldapmodify.bat
+++ b/opends/resource/bin/ldapmodify.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDAPModify"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=ldapmodify"
-call "%~dP0\..\lib\_client-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %*
 
diff --git a/opends/resource/bin/ldappasswordmodify.bat b/opends/resource/bin/ldappasswordmodify.bat
index 434ef40..82cab36 100644
--- a/opends/resource/bin/ldappasswordmodify.bat
+++ b/opends/resource/bin/ldappasswordmodify.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDAPPasswordModify"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=ldappasswordmodify"
-call "%~dP0\..\lib\_client-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %*
 
diff --git a/opends/resource/bin/ldapsearch.bat b/opends/resource/bin/ldapsearch.bat
index afb9db2..b98f53c 100644
--- a/opends/resource/bin/ldapsearch.bat
+++ b/opends/resource/bin/ldapsearch.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDAPSearch"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=ldapsearch"
-call "%~dP0\..\lib\_client-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %*
 
diff --git a/opends/resource/bin/ldif-diff.bat b/opends/resource/bin/ldif-diff.bat
index 1052bef..0a7b893 100644
--- a/opends/resource/bin/ldif-diff.bat
+++ b/opends/resource/bin/ldif-diff.bat
@@ -29,5 +29,6 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDIFDiff"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=ldif-diff"
-call "%~dP0\..\lib\_client-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %*
+
 
diff --git a/opends/resource/bin/ldifmodify.bat b/opends/resource/bin/ldifmodify.bat
index e2ec712..d524ab4 100644
--- a/opends/resource/bin/ldifmodify.bat
+++ b/opends/resource/bin/ldifmodify.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDIFModify"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=ldifmodify"
-call "%~dP0\..\lib\_server-script.bat" %*
+for %%i in (%~sf0) do  call "%%~dPsi\..\lib\_server-script.bat" %*
 
diff --git a/opends/resource/bin/ldifsearch.bat b/opends/resource/bin/ldifsearch.bat
index e9aa749..48f52a7 100644
--- a/opends/resource/bin/ldifsearch.bat
+++ b/opends/resource/bin/ldifsearch.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.LDIFSearch"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=ldifsearch"
-call "%~dP0\..\lib\_server-script.bat" %*
+for %%i in (%~sf0) do  call "%%~dPsi\..\lib\_server-script.bat" %*
 
diff --git a/opends/resource/bin/list-backends.bat b/opends/resource/bin/list-backends.bat
index ff1edbe..f77fb6e 100644
--- a/opends/resource/bin/list-backends.bat
+++ b/opends/resource/bin/list-backends.bat
@@ -29,5 +29,6 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.ListBackends"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=list-backends"
-call "%~dP0\..\lib\_server-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_server-script.bat" %*
+
 
diff --git a/opends/resource/bin/make-ldif.bat b/opends/resource/bin/make-ldif.bat
index 0ba5232..f842b0e 100644
--- a/opends/resource/bin/make-ldif.bat
+++ b/opends/resource/bin/make-ldif.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.makeldif.MakeLDIF"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=make-ldif"
-call "%~dP0\..\lib\_server-script.bat" --resourcePath "%~dP0..\config\MakeLDIF" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_server-script.bat" --resourcePath "%%~dPsi..\config\MakeLDIF" %*
 
diff --git a/opends/resource/bin/manage-account.bat b/opends/resource/bin/manage-account.bat
index 30f3bac..13ad037 100644
--- a/opends/resource/bin/manage-account.bat
+++ b/opends/resource/bin/manage-account.bat
@@ -29,5 +29,6 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.ManageAccount"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=manage-account"
-call "%~dP0\..\lib\_client-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %* 
+
 
diff --git a/opends/resource/bin/rebuild-index.bat b/opends/resource/bin/rebuild-index.bat
index ec5af25..ad45e31 100644
--- a/opends/resource/bin/rebuild-index.bat
+++ b/opends/resource/bin/rebuild-index.bat
@@ -29,5 +29,6 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.RebuildIndex"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=rebuild-index"
-call "%~dP0\..\lib\_server-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_server-script.bat" %*
+
 
diff --git a/opends/resource/bin/restore.bat b/opends/resource/bin/restore.bat
index bfd31ec..47f4813 100644
--- a/opends/resource/bin/restore.bat
+++ b/opends/resource/bin/restore.bat
@@ -29,5 +29,6 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.RestoreDB"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=restore"
-call "%~dP0\..\lib\_server-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_server-script.bat" %*
+
 
diff --git a/opends/resource/bin/start-ds.bat b/opends/resource/bin/start-ds.bat
index c4e2efb..2a8e243 100644
--- a/opends/resource/bin/start-ds.bat
+++ b/opends/resource/bin/start-ds.bat
@@ -26,8 +26,9 @@
 rem      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 
 setlocal
+for %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
 
-set DIR_HOME=%~dP0..
+
 set INSTANCE_ROOT=%DIR_HOME%
 
 set LOG="%INSTANCE_ROOT%\logs\native-windows.out"
diff --git a/opends/resource/bin/status-panel.bat b/opends/resource/bin/status-panel.bat
index 952481d..9265104 100644
--- a/opends/resource/bin/status-panel.bat
+++ b/opends/resource/bin/status-panel.bat
@@ -26,8 +26,8 @@
 rem      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 
 setlocal
+for %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
 
-set DIR_HOME=%~dP0..
 set INSTANCE_ROOT=%DIR_HOME%
 
 :checkJavaBin
diff --git a/opends/resource/bin/status.bat b/opends/resource/bin/status.bat
index 967eee2..5cec45a 100644
--- a/opends/resource/bin/status.bat
+++ b/opends/resource/bin/status.bat
@@ -29,4 +29,4 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.statuspanel.StatusCli"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=status"
-call "%~dP0\..\lib\_server-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_server-script.bat" %*
diff --git a/opends/resource/bin/stop-ds.bat b/opends/resource/bin/stop-ds.bat
index 2e9c88c..905539a 100644
--- a/opends/resource/bin/stop-ds.bat
+++ b/opends/resource/bin/stop-ds.bat
@@ -31,7 +31,7 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.StopDS"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=stop-ds"
-set DIR_HOME=%~dP0..
+for %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
 
 set INSTANCE_ROOT=%DIR_HOME%
 
diff --git a/opends/resource/bin/verify-index.bat b/opends/resource/bin/verify-index.bat
index 276dbbc..59e8a39 100644
--- a/opends/resource/bin/verify-index.bat
+++ b/opends/resource/bin/verify-index.bat
@@ -29,5 +29,6 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.VerifyIndex"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=verify-index"
-call "%~dP0\..\lib\_server-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_server-script.bat" %*
+
 
diff --git a/opends/resource/bin/windows-service.bat b/opends/resource/bin/windows-service.bat
index 8ee95e4..d03aa72 100644
--- a/opends/resource/bin/windows-service.bat
+++ b/opends/resource/bin/windows-service.bat
@@ -29,5 +29,5 @@
 
 set OPENDS_INVOKE_CLASS="org.opends.server.tools.ConfigureWindowsService"
 set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=windows-service"
-call "%~dP0\..\lib\_client-script.bat" %*
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %*
 
diff --git a/opends/resource/setup.bat b/opends/resource/setup.bat
index 8fd0f24..07ba26f 100644
--- a/opends/resource/setup.bat
+++ b/opends/resource/setup.bat
@@ -29,11 +29,14 @@
 
 rem check that the path does not contain the ^% character which breaks
 rem the batch files.
-set NON_ESCAPED=%~dPs0..
+for %%i in (%~sf0) do set NON_ESCAPED=%%~dPsi..
+
+
 FOR /F "tokens=1-2* delims=%%" %%1 IN ("%NON_ESCAPED%") DO (
 if NOT "%%2" == "" goto invalidPath)
 
-set DIR_HOME=%~dP0.
+for %%i in (%~sf0) do set DIR_HOME=%%~dPsi.
+
 set INSTANCE_ROOT=%DIR_HOME%
 
 :checkJavaBin
diff --git a/opends/resource/uninstall.bat b/opends/resource/uninstall.bat
index f7b2991..58eaee4 100644
--- a/opends/resource/uninstall.bat
+++ b/opends/resource/uninstall.bat
@@ -26,8 +26,8 @@
 rem      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 
 setlocal
+for %%i in (%~sf0) do set DIR_HOME=%%~dPsi.
 
-set DIR_HOME=%~dP0.
 set INSTANCE_ROOT=%DIR_HOME%
 
 :checkJavaBin
diff --git a/opends/resource/upgrade.bat b/opends/resource/upgrade.bat
index 726da68..d5dd67a 100644
--- a/opends/resource/upgrade.bat
+++ b/opends/resource/upgrade.bat
@@ -26,8 +26,8 @@
 rem      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 
 setlocal
+for %%i in (%~sf0) do set DIR_HOME=%%~dPsi.
 
-set DIR_HOME=%~dP0.
 set INSTANCE_ROOT=%DIR_HOME%
 
 :checkJavaBin

--
Gitblit v1.10.0