1 19 20 package org.netbeans.modules.ruby.rubyproject.execution; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import org.openide.filesystems.FileObject; 25 import org.openide.filesystems.FileUtil; 26 import org.openide.util.Exceptions; 27 28 33 public class DirectoryFileLocator implements FileLocator { 34 private FileObject root; 35 36 public DirectoryFileLocator(FileObject root) { 37 this.root = root; 38 } 39 40 public FileObject find(String file) { 41 try { 45 File f = new File (FileUtil.toFile(root), file); 46 if (f.exists()) { 47 f = f.getCanonicalFile(); 48 return FileUtil.toFileObject(f); 49 } 50 } catch (IOException ioe) { 51 Exceptions.printStackTrace(ioe); 52 } 53 return root.getFileObject(file); 54 } 55 } 56 | Popular Tags |