Web lists-archives.com

Re: [Mingw-msys] HAVE_SETMODE




I did some testing and found threads on the MINGW/MSYS mail lists that 
helped me figure out a fairly simple solution.  

All I needed to do was change the working directory for the current
process into the same format returned by $(cd "$BLDROOT"; pwd), 
which could be either an MSYS canonical or a mount rooted path. 

So for example, say the user set BLDROOT="C:\msys\1.0\user\joe\src" as
a system environment variable. Then the user opens a bash shell and cd's
to the src folder. 

The following bash code would work regardless of how the user got to the
src folder, some examples:

$ cd "C:\msys\1.0\home\joe"    # pwd would yield /mingw/msys/1.0/home/joe
$ cd "/c/msys/1.0/home/joe"    # pwd would yield /c/mingw/msys/1.0/home/joe
$ cd ~/src                     # pwd would yield /home/joe/src
$ cd /home/joe/src             # pwd would yield /home/joe/src

---- bash code snippet, lots of code omitted  ---------

if [[ $OSTYPE == msys ]]; then
    if (ls -d "$BLDROOT" 2>/dev/null); then
        BLDROOT=$(cd "$BLDROOT" && pwd  | tr '[:upper:]' '[:lower:]')
        cd `pwd -W`
    fi
fi

DIR1=$(cd ..; pwd) # could return either an MSYS canonical or a mount rooted path
DIR2=$(cd "$BLDROOT"; pwd) # if BLDROOT lives in MinGW or msys folder
                           # always returns a mount rooted path, else it 
                           # an MSYS canonical path

if [ "$DIR1" != "$DIR2" ]; then
   echo "$BLDROOT blah, blah blah..."
   exit 1
fi 

---- bash code snippet, lots of code omitted ---------
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Mingw-msys mailing list
Mingw-msys@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/mingw-msys