"use strict";var e=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function r(e){try{u(i.next(e))}catch(e){s(e)}}function a(e){try{u(i.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}u((i=i.apply(e,t||[])).next())}))},t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ensureOhPackageJson5=void 0;const n=t(require("path")),i=require("../../../common/Constants"),o=require("../../../util/FsUtil"),s=require("../../../common/message");exports.ensureOhPackageJson5=function(t){return e(this,void 0,void 0,(function*(){const e=n.default.join(t,i.Constants.PackageJson),r=n.default.join(t,i.Constants.MyPackageJson),a=yield o.FsUtil.exists(e);if(yield o.FsUtil.exists(r))a&&(yield o.FsUtil.rm(e));else{if(!a)throw new Error((0,s.format)(s.Messages.File.NotFoundOhPkgJson5,{pkgStoreDir:t}));yield o.FsUtil.rename(e,r)}}))};