Skip to content

Commit 3ed2a37

Browse files
zjt123andycall
authored andcommitted
fix:cookie delete file error
1 parent 58fb1b2 commit 3ed2a37

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

webf/lib/src/foundation/cookie_jar/file_storage.dart

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,40 @@ class FileStorage implements Storage {
2424
Future<void> delete(String key) async {
2525
final file = File('$_curDir$key');
2626
if (file.existsSync()) {
27-
await file.delete(recursive: true);
27+
try {
28+
await file.delete(recursive: true);
29+
} catch(e) {
30+
}
2831
}
2932
}
3033

3134
@override
3235
void deleteSync(String key) {
3336
final file = File('$_curDir$key');
3437
if (file.existsSync()) {
35-
file.deleteSync(recursive: true);
38+
try {
39+
file.deleteSync(recursive: true);
40+
} catch(e) {
41+
}
3642
}
3743
}
3844

3945
@override
4046
Future<void> deleteAll(List<String> keys) async {
41-
await Directory(_curDir!).delete(recursive: true);
47+
try {
48+
await Directory(_curDir!).delete(recursive: true);
49+
} catch(e) {
50+
}
4251
}
4352

4453
@override
4554
void deleteAllSync(List<String> keys) {
4655
Directory dir = Directory(_curDir!);
4756
if (dir.existsSync()) {
48-
dir.deleteSync(recursive: true);
57+
try {
58+
dir.deleteSync(recursive: true);
59+
} catch(e) {
60+
}
4961
}
5062
}
5163

0 commit comments

Comments
 (0)