fix bug 检查文件首层地址不应该固定
This commit is contained in:
@@ -58,16 +58,29 @@ export default class UploadController extends Controller {
|
|||||||
|
|
||||||
console.log('读取文件');
|
console.log('读取文件');
|
||||||
let files:any = await this.readFileDir(dirPath);
|
let files:any = await this.readFileDir(dirPath);
|
||||||
|
let msg = '', result = '';
|
||||||
|
for(let file of files) {
|
||||||
|
let flag = false;
|
||||||
|
|
||||||
let index = files.indexOf(folderName);
|
let arr = ['project.manifest', 'version.manifest', 'assets', 'src'];
|
||||||
if(index != -1) {
|
for(let fileName of arr) {
|
||||||
dirPath += '/' + folderName;
|
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'];
|
if(!result) {
|
||||||
for(let fileName of arr) {
|
throw new Error(msg);
|
||||||
console.log(dirPath + '/' + fileName)
|
|
||||||
let result = fs.existsSync(dirPath + '/' + fileName);
|
|
||||||
if(!result) throw new Error('缺少文件' + fileName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 历史记录压缩移动
|
// 历史记录压缩移动
|
||||||
|
|||||||
Reference in New Issue
Block a user