installNewReleaseFiles method

List<File> installNewReleaseFiles()

Install files with suffix .new_release. Files with .new_release are generated when selfReleaseDirectory is enabled.

Implementation

List<File> installNewReleaseFiles() {
  var newReleaseFiles = directoryFiles(directory)
      .where((f) => f.path.endsWith(_newReleaseSuffix))
      .toList();

  var movedFiles = <File>[];

  for (var file in newReleaseFiles) {
    var filePath = file.path;
    assert(filePath.endsWith(_newReleaseSuffix));

    var file2 = File(
        filePath.substring(0, filePath.length - _newReleaseSuffix.length));

    var fileMoved = file.renameSync(file2.path);
    movedFiles.add(fileMoved);
  }

  return movedFiles;
}