Commit ec0fa302 by tanghuan

修改判断assets中文件是否存在的判断方式

1 parent 75b573e5
......@@ -163,9 +163,12 @@ class LocalServerService {
var version = getIt.get<SharedPreferences>().getString(Constant.h5VersionKey) ?? Constant.h5Version;
var dir = await getApplicationSupportDirectory();
var distFilePath = '${dir.path}/${Constant.h5DistDir}/$version.zip';
if (!await File(distFilePath).exists()) {
if (!(await File(distFilePath).exists())) {
distFilePath = 'assets/$version.zip';
if (!await File(distFilePath).exists()) {
// 判断 assets 中的文件是否存在?抛出异常代表不存在
try {
await rootBundle.load(distFilePath);
} catch (e) {
distFilePath = 'assets/dist.zip';
}
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!