fix:unzip error
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import inquirer from "inquirer";
|
||||
import yauzl from "yauzl";
|
||||
import process from "node:process";
|
||||
import fs from "node:fs"
|
||||
import fse from "fs-extra";
|
||||
import { join, basename, dirname } from "node:path";
|
||||
import { platform, what_platform } from "./platform/index.js";
|
||||
@@ -37,7 +38,7 @@ if (!argv) {
|
||||
}
|
||||
|
||||
function initdir(){
|
||||
if(!fse.existsSync(unzip_path)){
|
||||
if(!fs.existsSync(unzip_path)){
|
||||
fse.ensureDirSync(join(unzip_path,"rubbish"))
|
||||
}
|
||||
}
|
||||
@@ -56,7 +57,7 @@ async function main(modpack_path: string) {
|
||||
if (/\/$/.test(entry.fileName)) {
|
||||
} else if (entry.fileName.includes("overrides/")) {
|
||||
const zipfilex = join(unzip_path, zipname,entry.fileName.replace("overrides/",""))
|
||||
if(!fse.existsSync(zipfilex)){
|
||||
if(!fs.existsSync(zipfilex)){
|
||||
zipfile.openReadStream(entry,(err,stream)=>{ //读取overrides文件夹下的所有文件和文件夹
|
||||
const dir = dirname(zipfilex)
|
||||
fse.ensureDirSync(dir);
|
||||
|
||||
Reference in New Issue
Block a user