This is the mail archive of the cygwin@sourceware.cygnus.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: How to use g++ when paths contain spaces?


> > > I can't seem to get my command lines or makefiles right when the path
to
> > > my include directories contain spaces.

> I totally agree about spaces in path names, but for a variety of reasons I
> need to access files from another application that the user might
> have installed under "Program Files".

Hello,

to avoid paths with blanks I convert them normally to old 8.3 syntax using
followinf functions:

function dospath
{
    local cr=$(echo -e "\r")
    pushd "$1" > /dev/null 2>&1
    # Use command.com to get 8.3 name,
    # have to remove trailing carriage return
    echo $(command.com /c cd) | sed -e s#$cr##g
    popd > /dev/null 2>&1
}
function dosname
{
    local p=$(dirname "$1")
    local dos=$(dospath "$p")
    local cr=$(echo -e "\r")
    # Use command.com to get 8.3 name,
    # have to remove trailing carriage return
    echo $(dospath "$p")/$(cmd.exe /c dir /x /b $dos\\$(basename "$1")) |
sed -e s#$cr##g
}


Usage:

> dosname "/Program files/winamp/readme.txt"
C:\PROGRA~1\WINAMP\README.TXT


If you want to have back the cygwin path, you may have to do some additional
processing :)

Greetings
Jörg


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

--
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]