delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/06/15/04:02:42

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <C2D7D58DBFE9D111B0480060086E96358D7082@gftmail.gft.de>
From: "Schaible, Joerg" <Joerg DOT Schaible AT gft DOT de>
To: "'cygwin-list'" <cygwin AT sourceware DOT cygnus DOT com>
Subject: RE: How to use g++ when paths contain spaces?
Date: Tue, 15 Jun 1999 10:01:15 +0200
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id EAA25922

> > > 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 AT sourceware DOT cygnus DOT com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019