Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
appframe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit ec0fa302
authored
2025-12-05 16:21:05 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改判断assets中文件是否存在的判断方式
1 parent
75b573e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
lib/services/local_server_service.dart
lib/services/local_server_service.dart
View file @
ec0fa30
...
@@ -163,9 +163,12 @@ class LocalServerService {
...
@@ -163,9 +163,12 @@ class LocalServerService {
var
version
=
getIt
.
get
<
SharedPreferences
>().
getString
(
Constant
.
h5VersionKey
)
??
Constant
.
h5Version
;
var
version
=
getIt
.
get
<
SharedPreferences
>().
getString
(
Constant
.
h5VersionKey
)
??
Constant
.
h5Version
;
var
dir
=
await
getApplicationSupportDirectory
();
var
dir
=
await
getApplicationSupportDirectory
();
var
distFilePath
=
'
${dir.path}
/
${Constant.h5DistDir}
/
$version
.zip'
;
var
distFilePath
=
'
${dir.path}
/
${Constant.h5DistDir}
/
$version
.zip'
;
if
(!
await
File
(
distFilePath
).
exists
(
))
{
if
(!
(
await
File
(
distFilePath
).
exists
()
))
{
distFilePath
=
'assets/
$version
.zip'
;
distFilePath
=
'assets/
$version
.zip'
;
if
(!
await
File
(
distFilePath
).
exists
())
{
// 判断 assets 中的文件是否存在?抛出异常代表不存在
try
{
await
rootBundle
.
load
(
distFilePath
);
}
catch
(
e
)
{
distFilePath
=
'assets/dist.zip'
;
distFilePath
=
'assets/dist.zip'
;
}
}
}
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment