[feat] solve common dir

todo: local cfg dir after resolving steam users
This commit is contained in:
Purp1e
2025-03-21 18:00:16 +08:00
parent 2e18fbdffd
commit e7a416dfec
10 changed files with 1170 additions and 754 deletions

View File

@@ -3,6 +3,7 @@ import { store } from "@tauri-store/valtio"
import { DEFAULT_STORE_CONFIG } from "./config"
import { useSnapshot } from "valtio"
import { invoke } from "@tauri-apps/api/core"
import path from "path"
const defaultValue = {
steamDir: "C:\\Program Files (x86)\\Steam",
@@ -36,6 +37,7 @@ export const useSteamStore = () => {
return {
state,
store: steamStore,
cs2BaseDir,
setDir,
setCsDir,
setUsers,
@@ -48,6 +50,10 @@ export const useSteamStore = () => {
}
}
const cs2BaseDir = () => {
return path.normalize(steamStore.state.cs2Dir.replaceAll("\\", "/") + "/../../..")
}
const setDir = (dir: string) => {
steamStore.state.steamDir = dir
}