1 19 20 package org.netbeans.modules.junit.output.antutils; 21 22 import java.io.File ; 23 import org.apache.tools.ant.module.spi.AntEvent; 24 import org.netbeans.modules.junit.output.antutils.FileUtils; 25 import org.openide.filesystems.FileUtil; 26 27 31 public final class AntProject { 32 33 34 private final AntEvent event; 35 36 private final File baseDir; 37 38 41 AntProject() { 42 event = null; 43 baseDir = null; 44 } 45 46 48 public AntProject(AntEvent event) { 49 this.event = event; 50 String baseDirName = getProperty("basedir"); if (baseDirName == null) { 52 baseDirName = "."; } 54 baseDir = FileUtil.normalizeFile(new File (baseDirName)); 55 } 56 57 59 public String getProperty(String propertyName) { 60 return event.getProperty(propertyName); 61 } 62 63 65 public String replaceProperties(String value) { 66 return event.evaluate(value); 67 } 68 69 71 public File resolveFile(String fileName) { 72 return FileUtils.resolveFile(baseDir, fileName); 73 } 74 75 85 public static boolean toBoolean(String s) { 86 return ("on".equalsIgnoreCase(s) || "true".equalsIgnoreCase(s) || "yes".equalsIgnoreCase(s)); } 90 91 } 92 | Popular Tags |