This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: set HOME environment


Hi Randall,

I already contributed the attached patch some times ago, that enhances
cygpath for the proper functionality. Meanwhile my disclaimer for the
contribution has reached Red Hat and the patch will be applied soon. With
the new option -s HOME could be set ignoring the blanks, since the filename
is converted into 8.3 format:

HOME=`cygpath -ws $USERPROFILE`
HOME=`cygpath -u $HOME`
export HOME

> 
> The presence of spaces in file name and path variables is indeed
> problematic. In particular, the PATH variable inherited by the shell
> from the Windows environment is rather likely to contain them, and
> programs that try to manipulate these variables assuming that they
> have no spaces will surely break.
> 
> Here's something I've done in lieu of fixing all the scripts I wrote
> with the tacit assumption of a space-less PATH variable:
> 
> -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--=
> =--==--==-
> if [ -z "$SYSPATH" ]; then
>     export            SYSPATH="$PATH"
>     export            SAFE_SYSPATH="$(echo "$PATH" |sed -e 
> 's/^[^:]* [^:]*://g' \
>                                                       -e 
> 's/:[^:]* [^:]*//g' )"
> 
>     syspath()        { echo "$SYSPATH" |tr ':' $'\n'; }
>     safesyspath()    { echo "$SAFE_SYSPATH" |tr ':' $'\n'; }
> fi
> 
> 
> resetPATH() {
>     # /usr/local/bin is first to give precedence to CygUtils
>     #    (see <http://cygutils.netpedia.net/>)
> 
>     FULL_PATH=":$HOME/bin:/usr/sbin://c/jdk1.3/bin:$SYSPATH"
>     SAFE_PATH=":$HOME/bin:/usr/sbin://c/jdk1.3/bin:$SAFE_SYSPATH"
> }
> 
> safePATH()            { PATH="$SAFE_PATH"; }
> fullPATH()            { PATH="$FULL_PATH"; }
> 
> resetSafePATH()        { resetPATH; safePATH; }
> resetFullPATH()        { resetPATH; fullPATH; }
> -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--=
> =--==--==-
> 
> I keep this code in a file called ~/.PATH, source that file in my
> .bash_profile and immediately thereafter invoke "resetSafePATH". If I
> ever need access to the directories excised from SAFE_PATH, I can
> issue "resetFullPATH" to get them back.
> 
> I hope some might find this useful.
> 

cygpath.cc-patch

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]