Replace rust version of this with frontend logic

This commit is contained in:
2026-02-14 13:03:31 -07:00
parent 70433b76ab
commit 81d47ea71d
5 changed files with 37 additions and 33 deletions

27
src/lib/Util.ts Normal file
View File

@@ -0,0 +1,27 @@
import { message } from '@tauri-apps/plugin-dialog'
import { BaseDirectory, exists, stat } from '@tauri-apps/plugin-fs'
import { openPath } from '@tauri-apps/plugin-opener'
import { join, appLocalDataDir } from '@tauri-apps/api/path'
export const openFolder = async (name: string) => {
const relativePath = await join('game', name)
const basePath = await appLocalDataDir()
const absolutePath = await join(basePath, relativePath)
const folderExists = await exists(relativePath, {
baseDir: BaseDirectory.AppLocalData
})
const folderStat = await stat(relativePath, {
baseDir: BaseDirectory.AppLocalData
})
if (!folderExists || folderStat.isFile) {
await message(`Game folder "${absolutePath}" not found.`, {
title: 'Folder not found',
kind: 'error'
})
return
}
await openPath(absolutePath)
}