import fs from 'fs';

Emitter.on('FetchMainAppCustomStyles', () => {
  const mainAppPath = Settings.get('mainAppStyleFile');
  const css = mainAppPath && fs.existsSync(mainAppPath) ? fs.readFileSync(mainAppPath, 'utf8') : '';
  Emitter.sendToAll('LoadMainAppCustomStyles', css);
});

Emitter.on('FetchGPMCustomStyles', () => {
  const gpmPath = Settings.get('gpmStyleFile');
  const css = gpmPath && fs.existsSync(gpmPath) ? fs.readFileSync(gpmPath, 'utf8') : '';
  Emitter.sendToGooglePlayMusic('LoadGPMCustomStyles', css);
});

import fs from 'fs';

Emitter.on('FetchMainAppCustomStyles', () => {
  const mainAppPath = Settings.get('mainAppStyleFile');
  if (mainAppPath && fs.existsSync(mainAppPath)) {
    fs.readFile(mainAppPath, 'utf8', (err, css) => {
      Emitter.sendToAll('LoadMainAppCustomStyles', err ? '' : css);
    });
  }
});

Emitter.on('FetchGPMCustomStyles', () => {
  const gpmPath = Settings.get('gpmStyleFile');
  if (gpmPath && fs.existsSync(gpmPath)) {
    fs.readFile(gpmPath, 'utf8', (err, css) => {
      Emitter.sendToGooglePlayMusic('LoadGPMCustomStyles', err ? '' : css);
    });
  }
});

Handle dumb paths being given to the custom CSS tooling
Handle dumb paths being given to the custom CSS tooling
