Committed by
GitHub
fix(flutter): fix unicode problem in windows path (#2508)
正在显示
4 个修改的文件
包含
5 行增加
和
5 行删除
| @@ -7,7 +7,7 @@ import "dart:io"; | @@ -7,7 +7,7 @@ import "dart:io"; | ||
| 7 | 7 | ||
| 8 | // Copy the asset file from src to dst | 8 | // Copy the asset file from src to dst |
| 9 | Future<String> copyAssetFile(String src, [String? dst]) async { | 9 | Future<String> copyAssetFile(String src, [String? dst]) async { |
| 10 | - final Directory directory = await getApplicationDocumentsDirectory(); | 10 | + final Directory directory = await getApplicationSupportDirectory(); |
| 11 | if (dst == null) { | 11 | if (dst == null) { |
| 12 | dst = basename(src); | 12 | dst = basename(src); |
| 13 | } | 13 | } |
| @@ -104,7 +104,7 @@ class IsolateTts { | @@ -104,7 +104,7 @@ class IsolateTts { | ||
| 104 | throw Exception('You are supposed to select a model by changing the code before you run the app'); | 104 | throw Exception('You are supposed to select a model by changing the code before you run the app'); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | - final Directory directory = await getApplicationDocumentsDirectory(); | 107 | + final Directory directory = await getApplicationSupportDirectory(); |
| 108 | modelName = p.join(directory.path, modelDir, modelName); | 108 | modelName = p.join(directory.path, modelDir, modelName); |
| 109 | 109 | ||
| 110 | if (ruleFsts != '') { | 110 | if (ruleFsts != '') { |
| @@ -109,7 +109,7 @@ Future<sherpa_onnx.OfflineTts> createOfflineTts() async { | @@ -109,7 +109,7 @@ Future<sherpa_onnx.OfflineTts> createOfflineTts() async { | ||
| 109 | 'You are supposed to select a model by changing the code before you run the app'); | 109 | 'You are supposed to select a model by changing the code before you run the app'); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | - final Directory directory = await getApplicationDocumentsDirectory(); | 112 | + final Directory directory = await getApplicationSupportDirectory(); |
| 113 | modelName = p.join(directory.path, modelDir, modelName); | 113 | modelName = p.join(directory.path, modelDir, modelName); |
| 114 | 114 | ||
| 115 | if (ruleFsts != '') { | 115 | if (ruleFsts != '') { |
| @@ -7,7 +7,7 @@ import 'package:path/path.dart' as p; | @@ -7,7 +7,7 @@ import 'package:path/path.dart' as p; | ||
| 7 | import 'package:path_provider/path_provider.dart'; | 7 | import 'package:path_provider/path_provider.dart'; |
| 8 | 8 | ||
| 9 | Future<String> generateWaveFilename([String suffix = '']) async { | 9 | Future<String> generateWaveFilename([String suffix = '']) async { |
| 10 | - final Directory directory = await getApplicationDocumentsDirectory(); | 10 | + final Directory directory = await getApplicationSupportDirectory(); |
| 11 | DateTime now = DateTime.now(); | 11 | DateTime now = DateTime.now(); |
| 12 | final filename = | 12 | final filename = |
| 13 | '${now.year.toString()}-${now.month.toString().padLeft(2, '0')}-${now.day.toString().padLeft(2, '0')}-${now.hour.toString().padLeft(2, '0')}-${now.minute.toString().padLeft(2, '0')}-${now.second.toString().padLeft(2, '0')}$suffix.wav'; | 13 | '${now.year.toString()}-${now.month.toString().padLeft(2, '0')}-${now.day.toString().padLeft(2, '0')}-${now.hour.toString().padLeft(2, '0')}-${now.minute.toString().padLeft(2, '0')}-${now.second.toString().padLeft(2, '0')}$suffix.wav'; |
| @@ -38,7 +38,7 @@ Future<void> copyAllAssetFiles() async { | @@ -38,7 +38,7 @@ Future<void> copyAllAssetFiles() async { | ||
| 38 | // Copy the asset file from src to dst. | 38 | // Copy the asset file from src to dst. |
| 39 | // If dst already exists, then just skip the copy | 39 | // If dst already exists, then just skip the copy |
| 40 | Future<String> copyAssetFile(String src, [String? dst]) async { | 40 | Future<String> copyAssetFile(String src, [String? dst]) async { |
| 41 | - final Directory directory = await getApplicationDocumentsDirectory(); | 41 | + final Directory directory = await getApplicationSupportDirectory(); |
| 42 | if (dst == null) { | 42 | if (dst == null) { |
| 43 | dst = p.basename(src); | 43 | dst = p.basename(src); |
| 44 | } | 44 | } |
-
请 注册 或 登录 后发表评论