avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <joerg.schai...@gmx.de>
Subject Re: release loose ends on Cygwin shell env
Date Tue, 23 Dec 2003 16:02:18 GMT
Hi Berin,

Berin Loritsch wrote:
> That is because it is using the WIndows java.exe command to execute
> things.
> There is a routine called cygpath or something to do the path
> translation.

Yes, but even the Windows java.exe can understand standard slashes as path
separators. The problem begins, when the path contains mounts or symlinks
that are only valid for Cygwin applications.

> To determine if we are working in a Cygwin environment you can do the
> following (pulled from the Maven script):


This already in place (at least for Cygwin).
> To convert things to Unix paths use something like the following (again
> pulled from the maven script):
> # For Cygwin, ensure paths are in UNIX format before anything is touched
> if $cygwin ; then
>    [ -n "$MAVEN_HOME" ] &&
>      MAVEN_HOME=`cygpath --unix "$MAVEN_HOME"`
>    [ -n "$MAVEN_HOME_LOCAL" ] &&
>      MAVEN_HOME_LOCAL=`cygpath --unix "$MAVEN_HOME_LOCAL"`
>    [ -n "$JAVA_HOME" ] &&
>      JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
>    [ -n "$CLASSPATH" ] &&
>      CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
> fi
> Lastly to convert to windows paths for Java (including the classpath):
> # For Cygwin, switch paths to Windows format before running java
> if $cygwin; then
>    [ -n "$MAVEN_HOME" ] &&
>      MAVEN_HOME=`cygpath --path --windows "$MAVEN_HOME"`
>    [ -n "$MAVEN_HOME_LOCAL" ] &&
>      MAVEN_HOME_LOCAL=`cygpath --path --windows "$MAVEN_HOME_LOCAL"`
>    [ -n "$JAVA_HOME" ] &&
>      JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
>    [ -n "$MAVEN_ENDORSED" ] &&
>      MAVEN_ENDORSED=`cygpath --path --windows "$MAVEN_ENDORSED"`
> fi

The last section is definately somewhat wrong. You may not use the "--path"
option for env variables that does not contain paths (remark: can contain
multiple values separated by a colon). Additionally CLASSPATH is not
converted back to DOSish format in this example.

If you have to concat multiple files for your defines on the Java
commandline (like it is done for Merlin with the bootstrap jar, policy file
and Merlin extenstion directory), you can do so safely after the
reconversion of the "root" variables using standard slashes (as long it is
save to assume, that these new elements in the path or the file itself are
no symlinks).

Writing bash scripts running also in Cygwin arise additional the problem,
that most scripts do not care about spaces in paths, although this is
clearly also a valid character in all Unix environments. In Cygwin
emulating Posix syntax in Windows you have often to deal with spaces, see
some defaults of the env variables mensioned above in Windows:

JAVA_HOME=c:\Program Files\java\jre
MAVEN_HOME=c:\Program Files\Apache Software Foundation\maven-1.0-rc1
MAVEN_LOCAL_HOME=c:\Documents and Settings\user\.maven

Although spaces are not Cygwin-specific you have often to fix the scripts
when they should run in Cygwin.


To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org

View raw message