let fs = require('fs');

const dirNames = __dirname.split('/');
const projectName = dirNames[dirNames.length - 2];
const path = '../play/assets'
const folderName = fs.readdirSync(path)[0];

if (projectName != folderName) {
  throw ('项目名与bundle文件夹名不相同');
}
let same = false;
const files = fs.readdirSync(`${path}/${folderName}/scene`);
files.forEach(fileName => {
  fileName.split('.').forEach((str, idx, arr) => {
    if (str == 'fire') {
      const sceneName = arr[idx - 1];
      if (folderName == sceneName) {
        same = true;
      }
    }
  })
});

if (!same) {
  throw ('bundle文件夹名称与scene名称不相同');
}