diff --git a/src/main/base/browserwindow.ts b/src/main/base/browserwindow.ts index 36544325..78d3b677 100644 --- a/src/main/base/browserwindow.ts +++ b/src/main/base/browserwindow.ts @@ -932,12 +932,15 @@ export class BrowserWindow { console.debug(`REPO ID: ${apiRepo.id}`); // extract the files from the first folder in the zip response let zip = new AdmZip(await response.buffer()); - let entry = zip.getEntries()[0]; if (!existsSync(join(utils.getPath("themes"), "gh_" + apiRepo.id))) { mkdirSync(join(utils.getPath("themes"), "gh_" + apiRepo.id)); } console.log(join(utils.getPath("themes"), "gh_" + apiRepo.id)); - zip.extractEntryTo(entry, join(utils.getPath("themes"), "gh_" + apiRepo.id), false, true); + zip.getEntries().forEach((entry) => { + if(entry.entryName.endsWith("/")) return + let subFolder = entry.entryName.split("/").slice(1, -1).join("/"); + zip.extractEntryTo(entry, join(utils.getPath("themes"), "gh_" + apiRepo.id, "/", subFolder), false, true); + }); let commit = await utils.fetch(`https://api.github.com/repos/${repo}/commits`).then((res) => res.json()); console.debug(`COMMIT SHA: ${commit[0].sha}`); let theme = JSON.parse(readFileSync(join(utils.getPath("themes"), "gh_" + apiRepo.id, "theme.json"), "utf8"));