mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-05 07:15:06 +08:00
♻️ 姑且能跑 dev,尚需调试功能
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
/**
|
||||
* @file utils/toolFunc.ts
|
||||
* @description 一些工具函数
|
||||
* @since Beta v0.4.1
|
||||
* @since Beta v0.5.0
|
||||
*/
|
||||
|
||||
import { os, path } from "@tauri-apps/api";
|
||||
import { path } from "@tauri-apps/api";
|
||||
import { type } from "@tauri-apps/plugin-os";
|
||||
import colorConvert from "color-convert";
|
||||
import type { KEYWORD } from "color-convert/conversions.js";
|
||||
import { v4 } from "uuid";
|
||||
@@ -108,17 +109,18 @@ export function bytesToSize(bytes: number): string {
|
||||
|
||||
/**
|
||||
* @description 获取缓存目录
|
||||
* @since Beta v0.3.4
|
||||
* @since Beta v0.5.0
|
||||
* @returns {string|string[]} 缓存目录
|
||||
*/
|
||||
export async function getCacheDir(): Promise<string[] | false> {
|
||||
const cacheDir = await path.appCacheDir();
|
||||
const osType = await os.type();
|
||||
if (osType === "Windows_NT") {
|
||||
const osType = type().toLowerCase();
|
||||
if (osType === "windows") {
|
||||
const cache = `${cacheDir}EBWebview${path.sep}Default${path.sep}Cache`;
|
||||
const codeCache = `${cacheDir}EBWebview${path.sep}Default${path.sep}Code Cache`;
|
||||
return [cache, codeCache];
|
||||
} else if (osType === "Darwin") {
|
||||
}
|
||||
if (osType === "macos") {
|
||||
return [`${cacheDir}WebKit`];
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user