saveFile method

  1. @override
Future<bool> saveFile(
  1. Release release,
  2. ReleaseFile file, {
  3. bool verbose = false,
})
override

Saves a file to this storage implementation.

Implementation

@override
Future<bool> saveFile(Release release, ReleaseFile file,
    {bool verbose = false}) async {
  var dir = releaseDirectory(release);

  var localFile = file.toFile(parentDirectory: dir);
  localFile.parent.createSync(recursive: true);

  if (!overwriteFiles && localFile.existsSync()) {
    localFile = File(localFile.path + _newReleaseSuffix);
  }

  var data = await file.data;

  localFile.writeAsBytesSync(data);
  localFile.setLastModifiedSync(file.time);

  if (file.executable) {
    setFileExecutablePermission(localFile, true);
  }

  if (verbose) {
    print('   ยป  ${file.toInfo()} > ${localFile.path}');
  }

  return true;
}