# ant-dev mailing list archives

##### Site index · List index
Message view
Top
From Michael Smith <mich...@sneakerlabs.com>
Subject Re: Path & dir separators (was Re: Ant Principles)
Date Wed, 19 Apr 2000 17:02:36 GMT
"Kuiper, Arnout" wrote:
> It's a good idea, but doesn't it make the build-file too complex?
> (Not to mention Ant itself). How is the OS name determined? "unix"
> is not a OS name, but a collection of different OSs.

I didn't think much about how the "os" part would work.  Whatever is used
for the exec task should be applied here as well.  This part is only needed
if your build file is already complex (with absolute paths on multiple
platforms where the extraneous path information causes problems).

> Let's recap:
>
> For the user on a single platform:
> - Just use the path/dir separators of the platform in the paths
>   in the build-file.
>
> For the user on multiple platforms without absolute paths:
> - Specify the separators in the project element
> - Use these path/dir separators in your paths in the build-file.
>
> For the user on multiple platforms with absolute paths:
> - Specify the separators in the project element
> - Use these path/dir separators in your paths in the build-file.
> - For each absolute path, use the construct where you can set
>   the path based on the platform.

yup...

> I assume here that the simple path declarations like
>
>   <copydir src="build" dest="../lib/dist"/>
>
> are still possible (thus without using the path construct).
>
> So for the most complex situation we would get (assuming the OS name
> issue has been resolved):
>
>   <copydir>
>     <src>
>       <path definition="c:\foo\bar"
>           os="win" dirseparator="\" pathseparator=";"/>
>       <path definition="/usr/local/foo/bar"
>           os="unix" dirseparator="/" pathseparator=":"/>
>     </src>
>     <dest>
>       <path definition="d:\xyz"
>           os="win" dirseparator="\" pathseparator=";"/>
>       <path definition="/home/xyz"
>           os="unix" dirseparator="/" pathseparator=":"/>
>     </dest>
>   </copydir>
>
> Is this all correct?

sounds correct to me...

only weirdness is the src and dest need to be available as nested elements
*and* as attributes.  I guess that would require both a setSrc and createSrc
methods on the task?  I'm not sure if that creates problems.

> If so, I think it is a good proposal, but we should come up
> with a way to that prevent tasks from being bother by complex
> path constructs. How about having a "Path" type which can be
> processed by the reflector in the Ant core? Then the tasks
> just need the setSomePath/addSomePath methods, and Ant itself
> takes care of the rest.

I think this was addressed by Thomas Haas's Path construct he posted a while
ago...

Regards,
michael

--
michael@sneakerlabs.com
http://www.sneakerlabs.com


Mime
View raw message