// Generated by CoffeeScript 1.10.0
(function() {
  var BINDIR, DATADIR, DESTNAME, ID, NAME, SOURCENAME, existsSync, fs, path;

  fs = require('fs.extra');

  path = require('path');

  NAME = 'myapp';

  ID = 'org.example.myapp';

  BINDIR = '/usr/bin';

  DATADIR = '/usr/share';

  SOURCENAME = 'dbus-example.js';

  DESTNAME = 'myapp';

  existsSync = function(filePath) {
    var err, error;
    try {
      fs.statSync(filePath);
    } catch (error) {
      err = error;
      if (err.code === 'ENOENT') {
        return false;
      }
    }
    return true;
  };

  if (existsSync(path.join(BINDIR, DESTNAME))) {
    fs.remove(path.join(BINDIR, DESTNAME), function(err) {
      if (err != null) {
        throw err;
      }
      return console.log("Deleted binary");
    });
  }

  if (existsSync(path.join(DATADIR, 'applications', ID + '.desktop'))) {
    fs.remove(path.join(DATADIR, 'applications', ID + '.desktop'), function(err) {
      if (err != null) {
        throw err;
      }
      return console.log("Deleted desktop file");
    });
  }

  if (existsSync(path.join(DATADIR, 'dbus-1/services', ID + '.service'))) {
    fs.remove(path.join(DATADIR, 'dbus-1/services', ID + '.service'), function(err) {
      if (err != null) {
        throw err;
      }
      return console.log("Copied service file");
    });
  }

}).call(this);
