"use strict";var e=this&&this.__awaiter||function(e,t,i,r){return new(i||(i=Promise))((function(s,n){function o(e){try{u(r.next(e))}catch(e){n(e)}}function l(e){try{u(r.throw(e))}catch(e){n(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,l)}u((r=r.apply(e,t||[])).next())}))},t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.deleteUselessDir=void 0;const i=require("../../../util/FsUtil"),r=t(require("path")),s=t(require("../../../log"));exports.deleteUselessDir=function(t,n){return e(this,void 0,void 0,(function*(){if(!(yield i.FsUtil.exists(t)))return;const e=yield i.FsUtil.readdirSilently(t);for(const o of e){const e=r.default.join(t,o);(yield i.FsUtil.stat(e)).isDirectory()&&!n(e)||(s.default.debug("",`found useless folder: "${e}"`),yield i.FsUtil.remove(e),s.default.info("",`remove useless folder succeed: "${e}"`))}yield i.FsUtil.rmEmptyDir(t)}))};