Changeset 23242 for main/trunk/ant-tasks
- Timestamp:
- 2010-10-28T10:14:17+13:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/ant-tasks/src/org/greenstone/anttasks/PatternSetToFile.java
r23211 r23242 15 15 * PatternSetToFile is an Ant task used to take an Ant PatternSet and output to a 16 16 * file all the files that it encompasses 17 * @author sjm8417 * @author Sam McIntosh 18 18 */ 19 19 public class PatternSetToFile extends Task 20 20 { 21 //Sets whether or not only the top-level files and folders 22 //are stored in the output file 23 public boolean _toplevelonly = false; 24 21 25 //The file the set will be written to 22 26 public File _outfile = null; … … 48 52 49 53 String[] includedFiles = ds.getIncludedFiles(); 54 55 if(_toplevelonly) 56 { 57 ArrayList toplevel = new ArrayList(); 58 59 for(int j = 0; j < includedFiles.length; j++) 60 { 61 int separatorIndex = includedFiles[j].indexOf(File.separator); 62 63 if ( separatorIndex == -1 && includedFiles[j].length() > 0 && !toplevel.contains(toplevel)) { 64 toplevel.add(includedFiles[j]); 65 } 66 else if ( separatorIndex > -1 && includedFiles[j].length() > 0) { 67 String path = includedFiles[j].substring(0, separatorIndex); 68 if ( !toplevel.contains(path) ) { 69 toplevel.add(path); 70 } 71 } 72 } 73 includedFiles = (String[])toplevel.toArray(new String[0]); 74 } 75 50 76 for (int j = 0; j < includedFiles.length; j++) 51 77 { … … 60 86 } 61 87 } 62 88 89 public void setToplevelonly(boolean toplevelonly) 90 { 91 _toplevelonly = toplevelonly; 92 } 93 63 94 public void setOutfile(File outfile) 64 95 { 65 96 _outfile = outfile; 66 97 } 67 98 68 99 public void setDir(File dir) 69 100 { … … 73 104 public void addConfiguredPatternset(PatternSet patternset) 74 105 { 75 if (patternset == null || !(patternset instanceof PatternSet))106 if (patternset == null) 76 107 { 77 108 return;
Note:
See TracChangeset
for help on using the changeset viewer.