toReleaseFile method
Converts this File to a ReleaseFile.
parentPathis removed from the ReleaseFile.filePath.- A ReleaseFile.filePath is always relative to the release
directory, so, if
parentPathis not provided (or doesn't match), the root prefix of the path is removed (a root separator or a Windows drive).
Implementation
ReleaseFile toReleaseFile({String? parentPath}) {
var path = this.path;
if (parentPath != null && path.startsWith(parentPath)) {
path = path.substring(parentPath.length);
} else {
path = splitPathRootPrefix(path)[1];
}
var data = FileDataProvider(this);
var executable =
hasExecutablePermission || ReleaseBundleZip.isExecutableFilePath(path);
return ReleaseFile(
path,
data,
time: lastModifiedSync(),
executable: executable,
);
}