コード例 #1
0
 public void cfgOutput(ConfigurationValue val, String str) throws ConfigurationException {
   if (str != null
       && (str.startsWith(File.separator)
           || str.startsWith("/")
           || FileUtils.isAbsolute(new File(str)))) {
     output = str;
   } else if (val.getContext() != null) {
     output = FileUtils.addPathComponents(val.getContext(), str, File.separatorChar);
   } else {
     output = str;
   }
 }
コード例 #2
0
ファイル: SwcCache.java プロジェクト: haibocheng/flex
  // changed from private to protected to support Flash Authoring - jkamerer 2007.07.30
  protected Map<String, Swc> getSwcs(String path) {
    Map<String, Swc> map = new LinkedHashMap<String, Swc>();
    File f = new File(path);
    if (!f.exists()) {
      throw new SwcException.SwcNotFound(path);
    }
    File catalog = new File(FileUtils.addPathComponents(path, Swc.CATALOG_XML, File.separatorChar));

    if (!f.isDirectory() || catalog.exists()) {
      Swc swc = getSwc(f);
      if (swc != null) {
        map.put(swc.getLocation(), swc);
      }
    } else {
      File[] files = FileUtils.listFiles(f);
      for (int i = 0; i < files.length; i++) {
        File file = files[i];

        // we don't want to snarf an entire directory tree, just a single level.
        if ((!file.isDirectory()) && file.canRead()) {
          String lowerCase = file.getName().toLowerCase();

          if (lowerCase.endsWith(GENSWC_EXTENSION)) // never automatically read genswcs
          continue;

          if (lowerCase.endsWith(SWC_EXTENSION)) {
            Swc swc = getSwc(file);
            if (swc != null) {
              map.put(swc.getLocation(), swc);
            }
          }
        }
      }
    }
    return map;
  }