From 3790ea866943ee7d040edb690e0d0ebb1766883d Mon Sep 17 00:00:00 2001 From: Apin Date: Mon, 19 Aug 2019 11:36:42 +0700 Subject: [PATCH] fix error reading any locales folder --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/localemanager.js | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f96042b..521753a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.1.2 + +- fix extension read all json from any locales folder + ## 0.1.1 - hot fix generate not working diff --git a/package.json b/package.json index 3113a85..4d75141 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "flutter-internationalize", "displayName": "flutter-internationalize", "description": "Flutter internationalizing tools", - "version": "0.1.1", + "version": "0.1.2", "publisher": "apin", "author": "Apin Prastya (https://lekapin.com)", "icon": "resources/icon.png", diff --git a/src/localemanager.js b/src/localemanager.js index bf67f98..cc82a31 100644 --- a/src/localemanager.js +++ b/src/localemanager.js @@ -40,7 +40,7 @@ class LocaleManager { if (folders.length == 1) { this.rootPath = folders[0].uri.path; this.rootFsPath = folders[0].uri.fsPath; - const a = await workspace.findFiles('**/locales/desc.json', '**/flutter_assets/locales/*.json', 5) + const a = await workspace.findFiles('locales/desc.json', null, 5) if (a.length === 0) { if (!fs.existsSync(path.join(this.rootFsPath, 'locales'))) fs.mkdirSync(path.join(this.rootFsPath, 'locales')) @@ -74,7 +74,7 @@ class LocaleManager { async readLocaleFile(descFileUri) { this.description = await this.loadText(descFileUri); this.load(this.description, true) - const allLocFiles = (await workspace.findFiles('**/locales/*.json', '**/flutter_assets/locales/*.json', 50)). + const allLocFiles = (await workspace.findFiles('locales/*.json', null, 50)). filter(v => !v.path.endsWith('desc.json') && !path.basename(v.path).startsWith('text_')) this.totalCount = allLocFiles.length; allLocFiles.forEach(v => {