mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 23:54:48 +01:00
solution for loose file mods
This commit is contained in:
@@ -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', {
|
||||
|
||||
@@ -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 }) => {
|
||||
|
||||
Reference in New Issue
Block a user