1 19 20 package org.netbeans.modules.ant.freeform; 21 22 import java.io.File ; 23 import org.openide.modules.InstalledFileLocator; 24 25 29 public final class TestInstalledFileLocator extends InstalledFileLocator { 30 31 private final File antHome; 32 33 34 public TestInstalledFileLocator() { 35 String anthome = System.getProperty("test.ant.home"); 36 assert anthome != null : "Must set system property test.ant.home"; 37 antHome = new File (anthome); 38 assert antHome.isDirectory() : "No such dir " + antHome; 39 } 40 41 public File locate(String relativePath, String codeNameBase, boolean localized) { 42 if (relativePath.equals("ant")) { 44 return new File ("/my/user/dir/ant"); 45 } else if (relativePath.equals("ant/nblib/bridge.jar") || relativePath.equals("ant/lib/ant.jar")) { 46 File f = new File (antHome, relativePath.substring(4).replace('/', File.separatorChar)); 47 if (f.exists()) { 48 return f; 49 } 50 } 51 return null; 52 } 53 54 } 55 | Popular Tags |