public File findModuleFile(String name) throws PybaseException { File dir = null; String[] comps = name.split("\\."); for (IPathSpec ps : project_paths) { if (!ps.isUser()) continue; File f = ps.getOSFile(base_directory); if (!f.exists()) continue; for (int i = 0; i < comps.length - 1; ++i) { f = new File(f, comps[i]); } if (f.exists()) { dir = f; break; } } if (dir == null) throw new PybaseException("Can't find package for new module " + name); File fil = new File(dir, comps[comps.length - 1] + ".py"); return fil; }
/** ***************************************************************************** */ void findPackage(String name, IvyXmlWriter xw) { File dir = null; String[] comps = name.split("\\."); for (IPathSpec ps : project_paths) { if (!ps.isUser()) continue; File f = ps.getOSFile(base_directory); if (!f.exists()) continue; for (int i = 0; i < comps.length; ++i) { f = new File(f, comps[i]); } if (f.exists()) { dir = new File(f, comps[comps.length - 1]); break; } } if (dir != null && xw != null) { xw.begin("PACKAGE"); xw.field("NAME", name); xw.field("PATH", dir.getAbsolutePath()); xw.end("PACKAGE"); } }