fix bug 检查文件首层地址不应该固定
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
// 历史记录压缩移动
|
||||
|
||||
Reference in New Issue
Block a user