From 9747e44135a4782d95b485d2f5a382c76f418bf6 Mon Sep 17 00:00:00 2001 From: Victor Kachalov Date: Wed, 18 Nov 2020 22:00:13 +0100 Subject: [PATCH] 2.0.4 fix --- CHANGELOG.md | 4 ++++ README.md | 2 +- bin/main.dart | 6 ++++-- pubspec.yaml | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a531aac..5a1ad07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [2.0.4] - 18.11.2020 + +* Race condition fixed + ## [2.0.3] - 18.11.2020 * Documentation improved diff --git a/README.md b/README.md index 62f1e2a..5379fc6 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ String extensions for localization and a translation utility - Add this to your package's pubspec.yaml file: ``` Dart dependencies: - localized: ^2.0.3 + localized: ^2.0.4 ``` - Get dependencies diff --git a/bin/main.dart b/bin/main.dart index c4ca45f..82d1f92 100644 --- a/bin/main.dart +++ b/bin/main.dart @@ -498,14 +498,16 @@ bool _isSupported(String locale) => kSupportedLanguages.contains(locale); /// Also check for [langCodes]. Will exit with code [0] if no /// lang codes were found. /// -void _createLocalizedFiles(List langCodes, String dirPath) { +Future _createLocalizedFiles( + List langCodes, String dirPath) async { if (langCodes.isEmpty) { stdout.writeln( 'To create files you need to provide at least one language code. Exiting...'); exit(0); } final directory = Directory(dirPath); - !directory.existsSync() + final exists = await directory.exists(); + !exists ? _createContent(directory, langCodes, dirPath) : _rewrite(directory, langCodes, dirPath); } diff --git a/pubspec.yaml b/pubspec.yaml index 70b524c..6f57a63 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: localized description: String extensions for different localizations and a translation utility without additional efforts. -version: 2.0.3 +version: 2.0.4 homepage: https://github.com/VictorKachalov/localized environment: