From 4755b64b26fcd84187118cf0fad0359f70fead01 Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 29 Nov 2023 14:27:18 +0100 Subject: [PATCH] Fix paths --- .../example/native_add_library/build.dart | 9 ++------- .../example/native_add_library/link.dart | 5 +++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/pkgs/native_assets_cli/example/native_add_library/build.dart b/pkgs/native_assets_cli/example/native_add_library/build.dart index 46723a6c3..017526a32 100644 --- a/pkgs/native_assets_cli/example/native_add_library/build.dart +++ b/pkgs/native_assets_cli/example/native_add_library/build.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:io'; - import 'package:logging/logging.dart'; import 'package:native_assets_cli/native_assets_cli.dart'; import 'package:native_toolchain_c/native_toolchain_c.dart'; @@ -34,16 +32,13 @@ void main(List args) async { ..level = Level.ALL ..onRecord.listen((record) => print(record.message)), ); - buildOutput.assets.add( Asset( id: 'package:$packageName/ajsonfile', linkMode: LinkMode.dynamic, target: buildConfig.target, - path: AssetAbsolutePath(File( - 'pkgs/native_assets_cli/example/native_add_library/data_asset_build.json') - .absolute - .uri), + path: AssetAbsolutePath( + buildConfig.packageRoot.resolve('data_asset_build.json')), type: AssetType.data, ), ); diff --git a/pkgs/native_assets_cli/example/native_add_library/link.dart b/pkgs/native_assets_cli/example/native_add_library/link.dart index 3b068b3b5..c6d6ad484 100644 --- a/pkgs/native_assets_cli/example/native_add_library/link.dart +++ b/pkgs/native_assets_cli/example/native_add_library/link.dart @@ -7,6 +7,7 @@ import 'package:native_assets_cli/native_assets_cli.dart'; const packageName = 'native_add_library'; void main(List args) async { final linkInput = await LinkInput.fromArgs(args); + final buildConfig = await BuildConfig.fromArgs(args); final shakenAssets = MyResourceShaker().shake( linkInput.buildOutput.assets, @@ -18,8 +19,8 @@ void main(List args) async { id: 'package:$packageName/ajsonfil2e', linkMode: LinkMode.dynamic, target: Target.androidArm, - path: AssetAbsolutePath(Uri.file( - '/home/mosum/projects/native/pkgs/native_assets_cli/example/native_add_library/data_asset_link.json')), + path: AssetAbsolutePath( + buildConfig.packageRoot.resolve('data_asset_link.json')), type: AssetType.data, ), );