File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ import { emit } from "@tauri-apps/api/event";
166166import { open } from " @tauri-apps/plugin-dialog" ;
167167import { remove } from " @tauri-apps/plugin-fs" ;
168168import { platform } from " @tauri-apps/plugin-os" ;
169- import { exit } from " @tauri-apps/plugin-process" ;
169+ import { relaunch } from " @tauri-apps/plugin-process" ;
170170import { backUpUserData , restoreUserData } from " @utils/dataBS.js" ;
171171import { getBuildTime } from " @utils/TGBuild.js" ;
172172import TGLogger from " @utils/TGLogger.js" ;
@@ -391,14 +391,18 @@ async function confirmDelCache(): Promise<void> {
391391 }
392392 await showLoading .start (" 正在清除缓存" );
393393 for (const dir of CacheDir ) {
394- await showLoading .update (dir );
395- await remove (dir , { recursive: true });
394+ try {
395+ await showLoading .update (dir );
396+ await remove (dir , { recursive: true });
397+ } catch (e ) {
398+ await TGLogger .Error (` [Config][confirmDelCache] 清除缓存失败 ${dir } ${e } ` );
399+ }
396400 }
397401 await showLoading .end ();
398402 await TGLogger .Info (" [Config][confirmDelCache] 缓存清除完成" );
399403 showSnackbar .success (" 缓存已清除!即将退出应用!" );
400404 await new Promise <void >((resolve ) => setTimeout (resolve , 1500 ));
401- await exit ();
405+ await relaunch ();
402406}
403407
404408// 恢复默认设置
Original file line number Diff line number Diff line change 11/**
2- * @file utils/toolFunc.ts
3- * @description 一些工具函数
4- * @since Beta v0.8.2
2+ * 一些工具函数
53 */
64
75import { AvatarExtResTypeEnum , AvatarExtTypeEnum } from "@enum/bbs.js" ;
@@ -122,14 +120,14 @@ export function bytesToSize(bytes: number): string {
122120}
123121
124122/**
125- * @description 获取缓存目录
126- * @since Beta v0.5.0
127- * @returns {string|string[] } 缓存目录
123+ * 获取缓存目录
124+ * @returns {Array<string>|false } 缓存目录
128125 */
129- export async function getCacheDir ( ) : Promise < string [ ] | false > {
126+ export async function getCacheDir ( ) : Promise < Array < string > | false > {
130127 const cacheDir = await path . appCacheDir ( ) ;
131128 const osType = type ( ) . toLowerCase ( ) ;
132129 if ( osType === "windows" ) {
130+ // TODO: 会报错显示占用
133131 const cache = `${ cacheDir } ${ path . sep ( ) } EBWebview${ path . sep ( ) } Default${ path . sep ( ) } Cache` ;
134132 const codeCache = `${ cacheDir } ${ path . sep ( ) } EBWebview${ path . sep ( ) } Default${ path . sep ( ) } Code Cache` ;
135133 return [ cache , codeCache ] ;
You can’t perform that action at this time.
0 commit comments