mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 16:14:48 +01:00
fix opening and some other stuff
This commit is contained in:
@@ -69,12 +69,8 @@ export class Mods extends React.Component<IProps, IState> {
|
|||||||
const firstLink = dlLinks[0].downloadUrl
|
const firstLink = dlLinks[0].downloadUrl
|
||||||
|
|
||||||
this.props.downloadHandler.addDownload(firstLink, modPath, async () => {
|
this.props.downloadHandler.addDownload(firstLink, modPath, async () => {
|
||||||
console.log('Unzipping:', mod.name)
|
|
||||||
const unzipRes = await unzip(modPath, modFolder, false)
|
const unzipRes = await unzip(modPath, modFolder, false)
|
||||||
|
|
||||||
console.log(`${unzipRes.new_folder}/modinfo.json`)
|
|
||||||
console.log(unzipRes)
|
|
||||||
|
|
||||||
// Write a modinfo.json file
|
// Write a modinfo.json file
|
||||||
invoke('write_file', {
|
invoke('write_file', {
|
||||||
path: `${unzipRes.new_folder}/modinfo.json`,
|
path: `${unzipRes.new_folder}/modinfo.json`,
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ export class ModTile extends React.Component<IProps, IState> {
|
|||||||
onMouseLeave={() => this.setState({ hover: false })}
|
onMouseLeave={() => this.setState({ hover: false })}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
// Disable downloading installed mods
|
// Disable downloading installed mods
|
||||||
if (!('id' in mod)) return this.openInExplorer()
|
if (this.props.path) return this.openInExplorer()
|
||||||
|
if (!('id' in mod)) return
|
||||||
|
|
||||||
this.props.onClick(mod)
|
this.props.onClick(mod)
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -169,8 +169,13 @@ export async function getInstalledMods() {
|
|||||||
return Object.keys(mods).map((path) => {
|
return Object.keys(mods).map((path) => {
|
||||||
const info = JSON.parse(mods[path]) as ModData | PartialModData
|
const info = JSON.parse(mods[path]) as ModData | PartialModData
|
||||||
|
|
||||||
|
const modPathArr = path.replace(/\\/g, '/').split('/')
|
||||||
|
|
||||||
|
// If there is a file in this path, remove it from the path
|
||||||
|
if (modPathArr[modPathArr.length - 1].includes('.')) modPathArr.pop()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
path,
|
path: modPathArr.join('/'),
|
||||||
info,
|
info,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user