Fixing Ant build that fails due to space in path

E

eran

Hi,

I’m trying to run an installation that uses Ant. The installation has
to update some files that are in an existing folder. The folder is
supposed to be assigned to a certain environment variable, which the
Ant script relies on. The problem is this: the folder contains a space
(program files...), and that breaks the installation.

The script is along the line of:
<exec dir="${AS_HOME}/bin" executable="cmd.exe" ... >
where AS_HOME contains the space. I’m not sure this exact command
fails, as there are others in the build.xml as well, but they all look
similar. I tried to wrap the path in the env. variable with quotes, to
no avail. I don’t mind changing the XML to a fixed path, but obviously
using more quotes above will do more harm than good.

I’m not familiar with Ant, and I don’t have the time to learn how to
use it properly. I just need this problem to be solved. Can anyone
tell me how can I make it work with spaces in the given path?
 
G

Gilbert Rebhan

eran said:
The script is along the line of:
<exec dir="${AS_HOME}/bin" executable="cmd.exe" ... >
where AS_HOME contains the space. I’m not sure this exact command [ ... ]
I’m not familiar with Ant, and I don’t have the time to learn how to
use it properly. I just need this problem to be solved. Can anyone
tell me how can I make it work with spaces in the given path?

the usual solution for probs withs spaces in path is =

"'...'" ,means try

<exec dir="'${AS_HOME}/bin'" executable="cmd.exe" ... >

if you're not sure, whether your property has spaces or not,
simply put it between those extra '...' and you're done.


Regards, Gilbert
 
L

Lew

eran said:
Anyway, I eventually found a simple solution: I mapped the folder as a
network drive, and that made the path much shorter, and without any
spaces. So instead of "C:\program files\xyz" [sic], I was able to work with
"F:\xyz".

or "C:\PROGRA~1\xyz"

--
Lew


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[Zionism, fascism, ethnic cleansing, terrorism, war crimes, Khasars,
Illuminati, NWO]

"The epithet "anti-Semitism" is hurled to silence anyone,
even other Jews, brave enough to decry Israel's systematic,
decades-long pogrom against the Palestinian Arabs.

Because of the Holocaust, "anti-Semitism" is such a powerful
instrument of emotional blackmail that it effectively pre-empts
rational discussion of Israel and its conduct.

It is for this reason that many good people can witness
daily evidence of Israeli inhumanity toward the "Palestinians'
collective punishment," destruction of olive groves,
routine harassment, judicial prejudice, denial of medical services,
assassinations, torture, apartheid-based segregation, etc. --
yet not denounce it for fear of being branded "anti-Semitic."

To be free to acknowledge Zionism's racist nature, therefore,
one must debunk the calumny of "anti-Semitism."

Once this is done, not only will the criminality of Israel be
undeniable, but Israel, itself, will be shown to be the
embodiment of the very anti-Semitism it purports to condemn."

--- Greg Felton,
Israel: A monument to anti-Semitism
 
E

eran

Thanks, Gilbert, but that didn't work. I can't say I payed a lot of
attention to the way I tried to use your solution - just wrapped the
path everywhere with the apostrophe.

Anyway, I eventually found a simple solution: I mapped the folder as a
network drive, and that made the path much shorter, and without any
spaces. So instead of "C:\program files\xyz", I was able to work with
"F:\xyz".
 
G

Gilbert Rebhan

eran said:
Thanks, Gilbert, but that didn't work. I can't say I payed a lot of
attention to the way I tried to use your solution - just wrapped the
path everywhere with the apostrophe.
Anyway, I eventually found a simple solution: I mapped the folder as a
network drive, and that made the path much shorter, and without any
spaces. So instead of "C:\program files\xyz", I was able to work with
"F:\xyz"

OK, good you found a solution.

I had several occasions where the "'...'" hack worked for me (f.e.
cvs modulenames with spaces, or path with spaces) but maybe it
doesn't work always.

But remember - like Lew also said in this thread - NEVER use a path
with spaces in it if possible,thank you Bill for
"Documents and Settings , Dokumente und Einstellungen ;-)


Regards, Gilbert
 
L

Lew

Gilbert Rebhanwrote:
I had several occasions where the "'...'" hack worked for me (f.e.

That's not a hack, that's how you include "special" but legal
characters.
cvs modulenames with spaces, or path with spaces) but maybe it
doesn't work always.

But remember - like Lew also said in this thread - NEVER use a path
with spaces in it if possible,

I never said that. Do not misquote me.

I did say that it is weird to put things under "Program Files/", but
that isn't because of the space, it's because "Program Files/" is for,
well, program files, not development files.

I find no problem using paths with spaces in them. I do not recommend
avoiding them. I did say to think about how to use quote marks, and
not to use them randomly in ignorance.
 
G

Gilbert Rebhan

Lew said:
Gilbert Rebhanwrote:

That's not a hack, that's how you include "special" but legal
characters.

I call it a 'hack' because normally i do not need such
special treatment, apart from xml entities (quot,amp,lt,gt ....)
I never said that. Do not misquote me.
I did say that it is weird to put things under "Program Files/", but
that isn't because of the space ...

Ok, seems i got you wrong
... it's because "Program Files/" is for,
well, program files, not development files.

+1, I used to have an own partition on windows
for system only, another for documents and settings, another
for projects only ..., Separating stuff or using a standard
project layout = /src, /bin, /dist , /libs, /doc ... is another
story
I find no problem using paths with spaces in them. I do not recommend
avoiding them.

I recommend to avoid them, as they are often a source of trouble.
A space in a filename /pathname maybe legal, but there's a bunch
of programs and libraries that do not handle legal filenames.
I would not recommend using german umlauts for path or
filenames either, even if they are allowed.

I did say to think about how to use quote marks, and
not to use them randomly in ignorance.

I did not say to use quote marks randomly but
"...'path/with spaces in it/' ..."

Using the 8.3 equivalent name you get via dir /x ...

C:\>dir /x
....

01.11.2007 13:45 <DIR> DOKUME~1 Dokumente und Einstellungen
07.06.2008 21:03 <DIR> ghc
01.11.2007 14:04 <DIR> POSTIN~1 Postinstall
15.06.2008 13:45 <DIR> PROGRA~1 Programme
13.02.2008 10:29 <DIR> ruby
15.07.2008 21:03 <DIR> totalcmd
28.05.2008 21:53 <DIR> WINXP

.... maybe a solution too, but why not simply using pathnames
without spaces or spaces replaced with '_' instead.
Makes life so much easier IMO


Regards, Gilbert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top