@@ -479,6 +479,7 @@ class LocalizationOptions {
479479LocalizationOptions parseLocalizationsOptionsFromYAML ({
480480 required File file,
481481 required Logger logger,
482+ required FileSystem fileSystem,
482483 required String defaultArbDir,
483484 required bool defaultSyntheticPackage,
484485}) {
@@ -497,14 +498,24 @@ LocalizationOptions parseLocalizationsOptionsFromYAML({
497498 throw Exception ();
498499 }
499500 return LocalizationOptions (
500- arbDir: _tryReadUri (yamlNode, 'arb-dir' , logger)? .path ?? defaultArbDir,
501- outputDir: _tryReadUri (yamlNode, 'output-dir' , logger)? .path,
502- templateArbFile: _tryReadUri (yamlNode, 'template-arb-file' , logger)? .path,
503- outputLocalizationFile: _tryReadUri (yamlNode, 'output-localization-file' , logger)? .path,
504- untranslatedMessagesFile: _tryReadUri (yamlNode, 'untranslated-messages-file' , logger)? .path,
501+ arbDir: _tryReadFilePath (yamlNode, 'arb-dir' , logger, fileSystem) ?? defaultArbDir,
502+ outputDir: _tryReadFilePath (yamlNode, 'output-dir' , logger, fileSystem),
503+ templateArbFile: _tryReadFilePath (yamlNode, 'template-arb-file' , logger, fileSystem),
504+ outputLocalizationFile: _tryReadFilePath (
505+ yamlNode,
506+ 'output-localization-file' ,
507+ logger,
508+ fileSystem,
509+ ),
510+ untranslatedMessagesFile: _tryReadFilePath (
511+ yamlNode,
512+ 'untranslated-messages-file' ,
513+ logger,
514+ fileSystem,
515+ ),
505516 outputClass: _tryReadString (yamlNode, 'output-class' , logger),
506517 header: _tryReadString (yamlNode, 'header' , logger),
507- headerFile: _tryReadUri (yamlNode, 'header-file' , logger) ? .path ,
518+ headerFile: _tryReadFilePath (yamlNode, 'header-file' , logger, fileSystem) ,
508519 useDeferredLoading: _tryReadBool (yamlNode, 'use-deferred-loading' , logger),
509520 preferredSupportedLocales: _tryReadStringList (yamlNode, 'preferred-supported-locales' , logger),
510521 syntheticPackage:
@@ -596,8 +607,8 @@ List<String>? _tryReadStringList(YamlMap yamlMap, String key, Logger logger) {
596607 throw Exception ();
597608}
598609
599- // Try to read a valid `Uri` or null from `yamlMap`, otherwise throw.
600- Uri ? _tryReadUri (YamlMap yamlMap, String key, Logger logger) {
610+ // Try to read a valid file `Uri` or null from `yamlMap` to file path , otherwise throw.
611+ String ? _tryReadFilePath (YamlMap yamlMap, String key, Logger logger, FileSystem fileSystem ) {
601612 final String ? value = _tryReadString (yamlMap, key, logger);
602613 if (value == null ) {
603614 return null ;
@@ -606,5 +617,5 @@ Uri? _tryReadUri(YamlMap yamlMap, String key, Logger logger) {
606617 if (uri == null ) {
607618 logger.printError ('"$value " must be a relative file URI' );
608619 }
609- return uri;
620+ return uri != null ? fileSystem.path. normalize (uri.path) : null ;
610621}
0 commit comments