solution for loose file mods

This commit is contained in:
SpikeHD
2022-07-24 20:59:08 -07:00
parent 412acdd317
commit 0551f3e6a0
3 changed files with 39 additions and 4 deletions

View File

@@ -65,7 +65,7 @@ export class Mods extends React.Component<IProps, IState> {
const firstLink = dlLinks[0].downloadUrl
this.props.downloadHandler.addDownload(firstLink, modPath, async () => {
const unzipRes = await unzip(modPath, modFolder, false)
const unzipRes = await unzip(modPath, modFolder, false, true)
// Write a modinfo.json file
invoke('write_file', {

View File

@@ -6,12 +6,18 @@ interface UnzipPayload {
new_folder: string
}
export function unzip(file: string, dest: string, topLevelStrip?: boolean): Promise<UnzipPayload> {
export function unzip(
file: string,
dest: string,
topLevelStrip?: boolean,
folderIfLoose?: boolean
): Promise<UnzipPayload> {
return new Promise((resolve) => {
invoke('unzip', {
zipfile: file,
destpath: dest,
topLevelStrip,
folderIfLoose,
})
listen('extract_end', ({ payload }) => {