const process = require('process');
const fs = require('fs');
const path = require('path');
const currDir = process.cwd();

let icons = [];
let iconsNames = [];

if (fs.existsSync(currDir + '/templates/icons/')) {
   const filesShop = fs.readdirSync(currDir + '/templates/icons/');

   filesShop.forEach(file => {
      if (path.extname(file) === '.svg') {
         icons.push(currDir + '/templates/icons/' + file);
         iconsNames.push(file);
      }
   });
}

if (fs.existsSync(currDir + '/admin/static/icons/')) {
   const filesEngine = fs.readdirSync(currDir + '/admin/static/icons/');

   filesEngine.forEach(file => {
      if (path.extname(file) === '.svg' && !iconsNames.includes(file)) {
         icons.push(currDir + '/admin/static/icons/' + file);
      }
   });
}


module.exports = icons;
