Esempio n. 1
0
 /**
  * Returns a list of all databases.
  *
  * @param ctx database context
  * @return list of databases
  */
 public static StringList list(final Context ctx) {
   final StringList db = new StringList();
   for (final IOFile f : ctx.mprop.dbpath().children()) {
     final String name = f.name();
     if (f.isDir() && !name.startsWith(".")) db.add(name);
   }
   return db.sort(false);
 }
Esempio n. 2
0
  /**
   * Recursively populates the cache.
   *
   * @param root root directory
   * @param pc file cache
   * @throws InterruptedException interruption
   */
  void add(final IOFile root, final ProjectCache pc) throws InterruptedException {
    // check if file cache was replaced or invalidated
    if (pc != cache) throw new InterruptedException();

    final IOFile[] files = root.children();
    for (final IOFile file : files) {
      if (file.name().equals(IO.IGNORESUFFIX)) return;
    }
    for (final IOFile file : files) {
      if (file.isDir()) {
        add(file, pc);
      } else {
        pc.add(file.path());
      }
    }
  }