/** Tries to open the log. Called from inside _logLock */ private void openLog() { closeLogStream(); WriteStream os = _os; _os = null; IoUtil.close(os); Path path = getPath(); if (path == null) { path = getPath(CurrentTime.getCurrentTime()); } Path parent = path.getParent(); try { if (!parent.isDirectory()) { if (!parent.mkdirs()) { /* XXX: logWarning(L.l("Can't create log directory {0}.\n", parent)); */ } } } catch (Exception e) { logWarning(L.l("Can't create log directory {0}.\n Exception={1}", parent, e), e); } Exception exn = null; for (int i = 0; i < 3 && _os == null; i++) { try { _os = path.openAppend(); } catch (IOException e) { exn = e; } } String pathName = path.getPath(); try { if (pathName.endsWith(".gz")) { _zipOut = _os; _os = Vfs.openWrite(new GZIPOutputStream(_zipOut)); } else if (pathName.endsWith(".zip")) { throw new ConfigException("Can't support .zip in path-format"); } } catch (Exception e) { if (exn == null) exn = e; } if (exn != null) logWarning( L.l( "Can't create log for {0}.\n User={1} Exception={2}", path, System.getProperty("user.name"), exn), exn); }
/** Adds the class of this resource. */ @Override protected void buildClassPath(ArrayList<String> pathList) { String path = null; if (_path instanceof JarPath) path = ((JarPath) _path).getContainer().getNativePath(); else if (_path.isDirectory()) path = _path.getNativePath(); if (path != null && !pathList.contains(path)) pathList.add(path); }
public String getType(Env env) { if (_path.isLink()) { return "link"; } else if (_path.isDirectory()) { return "dir"; } else if (_path.isFile()) { return "file"; } else { /// XXX: throw RuntimeException return null; } }
public boolean isDir(Env env) { return _path.isDirectory(); }