Skip to content

Commit

Permalink
Merge pull request #197 from lijy91/feat/locate_msix_assets_path_from…
Browse files Browse the repository at this point in the history
…_script_file_directory

feat: locate msix assets path from script file directory if necessary
  • Loading branch information
YehudaKremer committed May 21, 2023
2 parents a7eb228 + 68ed974 commit 6e0ad9d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/src/configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,19 @@ class Configuration {
throw 'Failed to locate or read package config.';
}

Package msixPackage =
packagesConfig.packages.firstWhere((package) => package.name == "msix");
Package? msixPackage = packagesConfig['msix'];

// Locate package config from script file directory
if (msixPackage == null) {
final scriptFile = File.fromUri(Platform.script);
packagesConfig = await findPackageConfig(scriptFile.parent);
msixPackage = packagesConfig?['msix'];
}

if (msixPackage == null) {
throw 'Failed to locate msix assets path.';
}

String path =
'${msixPackage.packageUriRoot.toString().replaceAll('file:///', '')}assets';

Expand Down

0 comments on commit 6e0ad9d

Please sign in to comment.