copyFileMeta function

Future<int> copyFileMeta(
  1. File src,
  2. File dst
)

Copy the file meta for executable

Implementation

Future<int> copyFileMeta(File src, File dst) async {
  var srcMode = (await src.stat()).mode;
  var dstMode = (await dst.stat()).mode;
  if (dst is FileExecutableSupport) {
    if (dstMode != FileStat.modeNotSupported) {
      if (srcMode != FileStat.modeNotSupported) {
        if (_isUnixExecutable(srcMode) != _isUnixExecutable(dstMode)) {
          await (dst.setExecutablePermission(_isUnixExecutable(srcMode)));
        }
      }
    }
  }
  return 0;
}