fix: manually remove leading slash for compiler path on Windows when building for Android

This commit is contained in:
Nick Fisher committed 2024-07-23 09:38:25 +08:00
1 parent 7b3ad027bf
commit 7704a06601
1 file changed
+10 -2
+10 -2
View File
@@ -176,9 +176,17 @@ void main(List<String> args) async {
Architecture.ia32 => "i686-linux-android", Architecture.ia32 => "i686-linux-android",
_ => throw FormatException('Invalid') _ => throw FormatException('Invalid')
}; };
var ndkRoot = File(config.cCompiler.compiler!.path).parent.parent.path;
var compilerPath = config.cCompiler.compiler!.path;
if(Platform.isWindows && compilerPath.startsWith("/")) {
compilerPath = compilerPath.substring(1);
}
var ndkRoot = File(compilerPath).parent.parent.uri.toFilePath(windows:true);
var stlPath = var stlPath =
File("$ndkRoot/sysroot/usr/lib/${archExtension}/libc++_shared.so"); File([ndkRoot, "sysroot", "usr", "lib", archExtension, "libc++_shared.so"].join(Platform.pathSeparator));
output.addAsset(NativeCodeAsset( output.addAsset(NativeCodeAsset(
package: "thermion_dart", package: "thermion_dart",
name: "libc++_shared.so", name: "libc++_shared.so",