mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 07:34:36 +01:00
fix funky paths
This commit is contained in:
@@ -8,5 +8,20 @@ export async function getGameExecutable() {
|
||||
}
|
||||
|
||||
const pathArr = config.game_install_path.replace(/\\/g, '/').split('/')
|
||||
return pathArr[pathArr.length - 1].replace('.exe', '')
|
||||
return pathArr[pathArr.length - 1]
|
||||
}
|
||||
|
||||
export async function getGameFolder() {
|
||||
const config = await getConfig()
|
||||
|
||||
if(!config.game_install_path) {
|
||||
return null
|
||||
}
|
||||
|
||||
const pathArr = config.game_install_path.replace(/\\/g, '/').split('/')
|
||||
pathArr.pop()
|
||||
|
||||
const path = pathArr.join('/')
|
||||
|
||||
return path
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
import { invoke } from '@tauri-apps/api'
|
||||
import { dataDir } from '@tauri-apps/api/path'
|
||||
import { getConfig } from './configuration'
|
||||
import { getGameExecutable } from './game'
|
||||
import { getGameExecutable, getGameFolder } from './game'
|
||||
|
||||
export async function patchMetadata() {
|
||||
const metadataExists = await invoke('dir_exists', {
|
||||
path: getGameMetadataPath() + '\\global-metadata.dat'
|
||||
path: await getGameMetadataPath() + '\\global-metadata.dat'
|
||||
})
|
||||
|
||||
console.log(await getGameMetadataPath())
|
||||
|
||||
if (!metadataExists) {
|
||||
return false
|
||||
}
|
||||
@@ -164,14 +166,13 @@ export async function unpatchGame() {
|
||||
}
|
||||
|
||||
export async function getGameMetadataPath() {
|
||||
const config = await getConfig()
|
||||
const gameExec = await getGameExecutable()
|
||||
|
||||
if (!gameExec) {
|
||||
return null
|
||||
}
|
||||
|
||||
return config.game_install_path + '\\' + gameExec.replace('.exe', '_Data') + '\\Managed\\Metadata'
|
||||
return (await getGameFolder() + '\\' + gameExec.replace('.exe', '_Data') + '\\Managed\\Metadata').replace(/\\/g, '/')
|
||||
}
|
||||
|
||||
export async function getBackupMetadataPath() {
|
||||
|
||||
Reference in New Issue
Block a user