ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Price <>
Subject Re: ant on Cygwin -- spaces in dirnames
Date Fri, 28 Feb 2003 21:29:30 GMT

Thanks a lot for your response!  I agree emphatically about spaces in 
filenames -- I'm an underscore man myself.  I did solve the problem 
using the exact steps you described, essentially putting the `dirname 
"$PRG"` line into its own variable and simply replacing every occurrence 
of `dirname "$PRG"` with this variable throughout the script.

I suppose forward-compatibility isn't so much a big deal since I can 
always make the change again (it was really a five-minute fix).  Glad to 
hear I'm not the only one trying to make life easier with Cygwin and Ant!


David Knox wrote:
> Hi Eric,
> I'm an emphatic cygwin and ant user. I've not had the problem that you
> describe, but I'm not a believer in putting spaces in directory names.
> I've never derived enough benefit from the practice that I am compelled
> to use the practice. Consequently, there isn't much that I allow to be
> installed into the "Program Files" directory. 
> You might be able to get around the problem by making sure that the Ant
> script puts quotes around the qualified directory. In other words, 'cd
> "dirname" "$PRG"'. Another possible strategy would entail using a cygwin
> tool called cygpath that can map semantic differences between unix and
> windows path structures. There should be a man on cygpath in the cygwin
> distribution.
> The solution to the problem is to take control of installations on your
> windows machine. Installers tend to default to the Program Files
> directory but in most cases (unless the program you are installing has
> inappropriate dependencies on the Program Files directory) you can
> install into any directory you wish.
> Hth,
> -- dave
>>-----Original Message-----
>>From: Erik Price []
>>Sent: Friday, February 28, 2003 10:48 AM
>>To: Ant Users List
>>Subject: ant on Cygwin -- spaces in dirnames
>>I have installed Ant onto my Win2k box (which runs Cygwin) by
>>downloading the ZIP binary distribution (1.5) and putting it in
>>/cygdrive/c/Program Files/ant/ .  I have added the ant distribution's
>>bin directory to my path, and can execute the ant wrapper script by
>>localhost$ ant
>>from the Cygwin command line.  The problem is that I get an error
>>whenever I do run this command:
>>cd: can't cd to /cygdrive/c/Program
>>I have looked over the ant wrapper script and can see the problem, on
>>line 52, it says:
>>   # need this for relative symlinks
>>   cd `dirname "$PRG"`
>>The problem is that the result of `dirname "$PRG"` is a file path with
> a
>>space in it.  I would like to solve this problem.  Can anyone counsel
> me
>>in the best solution:
>>1. Manually fix the shell script by adding additional variables to
>>escape the space in the pathname at every point where `dirname "$PRG"`
>>is used.
>>2. Move the Ant distribution to a directory without a space.
>>3. Some other solution that I am not aware of?
>>1. is not really ideal, since it seems like unnecessary work (surely
> I'm
>>not the only person using ant on Cygwin) and would need to be done
> again
>>if I upgrade to a new Ant, plus it de-virginizes my ant shell script.
>>2. is not really ideal because it seems there are precious few
>>directories without spaces in their names on this machine.  (I am not
>>very knowledgeable of Windows.)
>>I'm curious how other Cygwin users install Ant so that it works for
>>them.  Am I not doing something right?  I am really inexperienced with
>>both Cygwin and Windows issues so please forgive me if the solution is
>>To unsubscribe, e-mail:
>>For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message