♻️ 姑且能跑 dev,尚需调试功能

This commit is contained in:
目棃
2024-07-02 23:05:33 +08:00
parent 1214501691
commit 367307029b
66 changed files with 12626 additions and 2887 deletions

View File

@@ -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;