diff --git a/gm-server/app/controller/upload.ts b/gm-server/app/controller/upload.ts index 7c0f4325f..9acb694c0 100644 --- a/gm-server/app/controller/upload.ts +++ b/gm-server/app/controller/upload.ts @@ -58,16 +58,29 @@ export default class UploadController extends Controller { console.log('读取文件'); let files:any = await this.readFileDir(dirPath); - - let index = files.indexOf(folderName); - if(index != -1) { - dirPath += '/' + folderName; + let msg = '', result = ''; + for(let file of files) { + let flag = false; + + let arr = ['project.manifest', 'version.manifest', 'assets', 'src']; + for(let fileName of arr) { + console.log(`${dirPath}/${file}/${fileName}`); + let result = fs.existsSync(`${dirPath}/${file}/${fileName}`); + if(!result) { + msg = '缺少文件' + fileName; + flag = true; + break; + } + } + if(flag) { + continue; + } else { + result = file; + dirPath += `/${file}`; + }; } - let arr = ['project.manifest', 'version.manifest', 'assets', 'src']; - for(let fileName of arr) { - console.log(dirPath + '/' + fileName) - let result = fs.existsSync(dirPath + '/' + fileName); - if(!result) throw new Error('缺少文件' + fileName); + if(!result) { + throw new Error(msg); } // 历史记录压缩移动