fix opening and some other stuff

This commit is contained in:
SpikeHD
2022-07-24 20:12:30 -07:00
parent 552d612e7c
commit c42c708db5
3 changed files with 8 additions and 6 deletions

View File

@@ -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`,

View File

@@ -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)
}} }}

View File

@@ -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,
} }
}) })