> -----Original Message-----
> From: Mariusz Nowostawski [mailto:mariusz@marni.otago.ac.nz]
[SNIP]
> Options once again:
> 1. Modify DirectoryScanner to accept files as well (the check
> whether it
> is a file or directory is done inside DirectoryScanner) -
> the code for
> some Matching Tasks is simpler and more uniform.
>
> 2. Modify just chmod (and others) tasks to be Matching Tasks
> (when it is
> appropriate). This would require a check whether "src" is
> directory or
> a file and react accordingly to that in each single Matching Task.
>
> 3. others
I wrote the DirectoryScanner for the purpose of scanning directories
based on include/exclude patterns. That is its sole responsibility.
It is possible to make a hack which returns the file, when a file is
passed instead of a directory.
I object against that for semantical reasons. It's strange to pass
a file to something that works with directories. (You don't ask
a copydir command to copy a file; you use copyfile instead).
A way a "proposed" in the past, is to have two attributes. For chmod
these could be "file" and "dir". This way you have a clear distinction
between files/directories, and you prevent errors. (If you have only one
attribute src, and you passed a directory instead of a file by mistake,
your whole tree will be chmod instead of just the file you wanted).
Right now, I'm working on a proposal for a the interfaces of a set
of core tasks, such that these tasks will have a common look & feel.
This proposal will also cover the include/exclude of chmod.
- Arnout
|