nixpkgs/pkgs/development/compilers/flutter/patches/flutter3/copy-without-perms.patch
hacker1024 7f01352e65 flutter: Don't preserve prebuilt SDK asset file permissions
See: https://github.com/flutter/flutter/issues/119961

Co-authored-by: FlafyDev <flafyarazi@gmail.com>
Co-authored-by: gilice <gilice@proton.me>
Co-authored-by: hacker1024 <hacker1024@users.sourceforge.net>
2023-04-13 18:01:53 +10:00

18 lines
854 B
Diff

diff --git a/packages/flutter_tools/lib/src/build_system/targets/assets.dart b/packages/flutter_tools/lib/src/build_system/targets/assets.dart
index 5f458bd53e..7a6c59f98d 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/assets.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/assets.dart
@@ -128,7 +128,11 @@ Future<Depfile> copyAssets(
break;
}
if (doCopy) {
- await (content.file as File).copy(file.path);
+ // Not using File.copy because it preserves permissions.
+ final sourceFile = content.file as File;
+ final destinationFile = file;
+
+ await destinationFile.writeAsBytes(await sourceFile.readAsBytes(), flush: true);
}
} else {
await file.writeAsBytes(await entry.value.contentsAsBytes());