From 4dffc27157b90a32ba5d8df27aaa7e3b03bf62ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E5=A8=87?=
Date: Tue, 5 Mar 2024 11:14:49 +0800
Subject: [PATCH] add vc runtime dlls
---
dev/windows_evb_config_generator.dart | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/dev/windows_evb_config_generator.dart b/dev/windows_evb_config_generator.dart
index d7a3a1e..67bd0ce 100644
--- a/dev/windows_evb_config_generator.dart
+++ b/dev/windows_evb_config_generator.dart
@@ -9,6 +9,22 @@ void main() {
// Windows runner of Github Actions. I cannot test it on a physical Windows machine.
final windowsBuildDir = Directory(r"build\windows\x64\runner\Release").absolute;
// use this for test: "build/linux/x64/release/bundle"
+
+ // add vc runtime dlls according to https://docs.flutter.dev/platform-integration/windows/building
+ // works find on a newly installed windows vm, but still not work on wine.
+ for (var e in [
+ File(r'C:\Windows\System32\msvcp140.dll'),
+ File(r'C:\Windows\System32\vcruntime140.dll'),
+ File(r'C:\Windows\System32\vcruntime140_1.dll'),
+ ]) {
+ try {
+ e.copySync(windowsBuildDir.path + r'\' + e.name);
+ } catch (e, s) {
+ print(e);
+ print(s);
+ }
+ }
+
final entities = windowsBuildDir.listSync();
final input = entities.firstWhere((e) => e is File && e.path.endsWith('.exe'));
final output = File(input.name).absolute;