'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = moveSync;

var _path;

function _load_path() {
  return _path = require('path');
}

var _fsExtra;

function _load_fsExtra() {
  return _fsExtra = _interopRequireDefault(require('fs-extra'));
}

var _generalError;

function _load_generalError() {
  return _generalError = _interopRequireDefault(require('../../error/general-error'));
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function moveSync(src, dest, options) {
  if (!(0, (_path || _load_path()).isAbsolute)(src) || !(0, (_path || _load_path()).isAbsolute)(dest)) {
    throw new Error(`moveSync, src and dest must be absolute. Got src "${src}", dest "${dest}"`);
  }
  try {
    (_fsExtra || _load_fsExtra()).default.moveSync(src, dest, options);
  } catch (err) {
    if (err.message.includes('Cannot move') && err.message.includes('into itself')) {
      throw new (_generalError || _load_generalError()).default(`unable to move '${src}' into itself '${dest}'`);
    }
    throw err;
  }
}