I have two questions about the dirset type in Apache Ant.
- Is a dirset really a set, with no order guaranteed, or does it preserves the input order?
I want to use ant:contrib to iterate over a set of directories and order matters, so if Ant’s dirset does not preserve insertion-order, what alternatives do I have? - How can I test if a certain dir is included within a dirset?
[Edit]
If you look at the dirset source It looks like it uses java
File.list(), whose documentation states that there is no gauranteed order.So no you can’t count on that absolutely.However, before returning it callsArrays.sort(files);See Line 1572.As per preserving order I couldn’t say, I would hazard that there is no guarantee but that it usually just happens to preserve the file systems order.As to testing, I presume you want, do action if this file exists or something similar, using ant contrib,
If there is nothing in the dirset if won’t do anything.