var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.launchKaiOSSimulator=void 0;var _path=_interopRequireDefault(require("path"));

var _fileutils=require("../../systemManager/fileutils");
var _logger=require("../../systemManager/logger");
var _constants=require("../../constants");

var childProcess=require('child_process');

var launchKaiOSSimulator=function launchKaiOSSimulator(c){return new Promise(function(resolve,reject){var _c$buildConfig,_c$buildConfig$sdks,_c$buildConfig2,_c$buildConfig2$sdks;
(0,_logger.logTask)('launchKaiOSSimulator');

if(!((_c$buildConfig=c.buildConfig)!=null&&(_c$buildConfig$sdks=_c$buildConfig.sdks)!=null&&_c$buildConfig$sdks.KAIOS_SDK)){
reject(
_constants.KAIOS_SDK+" is not configured in your "+
c.paths.workspace.config+" file. Make sure you add location to your Kaiosrt App path similar to: "+
(0,_logger.chalk)().white.bold(
'"KAIOS_SDK": "/Applications/Kaiosrt.app"'));


return;
}

var ePath=(0,_fileutils.getRealPath)(
_path.default.join((_c$buildConfig2=c.buildConfig)==null?void 0:(_c$buildConfig2$sdks=_c$buildConfig2.sdks)==null?void 0:_c$buildConfig2$sdks.KAIOS_SDK));


if(!(0,_fileutils.fsExistsSync)(ePath)){
reject("Can't find emulator at path: "+ePath);
return;
}

childProcess.exec("open "+ePath,function(err){
if(err){
reject(err);
return;
}
resolve();
});
});};exports.launchKaiOSSimulator=launchKaiOSSimulator;
//# sourceMappingURL=kaios.js.map