private FileInfo processNextRecord()

in agent/src/jetbrains/buildServer/swabra/snapshots/iteration/SnapshotFilesIterator.java [52:78]


  private FileInfo processNextRecord() throws IOException {
    String fileRecord;
    while ((fileRecord = myReader.readLine()) != null) {
      final String path = getFilePath(fileRecord);
      final long length = getFileLength(fileRecord);
      final long lastModified = getFileLastModified(fileRecord);

      final boolean isDirectory = path.endsWith("/") || path.endsWith("\\");
      final boolean skipCurrentDir = !myCurrentDir.isEmpty() && mySkipDir != null && hasParentOf(myCurrentDir, mySkipDir);
      if (isDirectory) {
        final String newDir = myRootFolder + path;
        if (skipCurrentDir && newDir.startsWith(mySkipDir)) {
          continue;
        }
        mySkipDir = null;
        myCurrentDir = newDir;
        return new FileInfo(myCurrentDir.substring(0, myCurrentDir.length() - 1), length, lastModified, false);
      } else {
        if (skipCurrentDir) {
          continue;
        }
        return new FileInfo(myCurrentDir + path, length, lastModified, true);
      }
    }
    myReader.close();
    return null;
  }