From 7704a06601dab0d183b4aa776d5671f69dc22767 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Thu, 11 Jul 2024 20:50:31 +1000 Subject: [PATCH] fix: manually remove leading slash for compiler path on Windows when building for Android --- thermion_dart/hook/build.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/thermion_dart/hook/build.dart b/thermion_dart/hook/build.dart index 25a1bad1..830ac0d4 100644 --- a/thermion_dart/hook/build.dart +++ b/thermion_dart/hook/build.dart @@ -176,9 +176,17 @@ void main(List args) async { Architecture.ia32 => "i686-linux-android", _ => 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 = - File("$ndkRoot/sysroot/usr/lib/${archExtension}/libc++_shared.so"); + File([ndkRoot, "sysroot", "usr", "lib", archExtension, "libc++_shared.so"].join(Platform.pathSeparator)); output.addAsset(NativeCodeAsset( package: "thermion_dart", name: "libc++_shared.so",