From: Woongsuk Cho Date: Fri, 10 Aug 2018 01:15:09 +0000 (+0900) Subject: support corerun mode X-Git-Tag: accepted/tizen/unified/20180921.143122~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7026b9f41af58aac0040ca51aa1a478af574e17;hp=6695a6255a14bd98691369a0158ea26e3a4b082a;p=platform%2Fcore%2Fdotnet%2Flauncher.git support corerun mode Change-Id: Ieed7de4eeec2238e02191c4669bd28aa15bde1c1 --- diff --git a/NativeLauncher/launcher/main.cc b/NativeLauncher/launcher/main.cc index e62e42e..9f64ebc 100644 --- a/NativeLauncher/launcher/main.cc +++ b/NativeLauncher/launcher/main.cc @@ -35,15 +35,16 @@ static std::string StandaloneOption("--standalone"); extern "C" int realMain(int argc, char *argv[], const char* mode) { int i; - bool standalone = false; + bool standaloneMode = false; char* standalonePath = nullptr; + bool corerunMode = false; std::vector vargs; // start index 1 to avoid passing executable name "dotnet-launcher" as a parameter for (i = 1; i < argc; i++) { if (StandaloneOption.compare(argv[i]) == 0) { - standalone = true; + standaloneMode = true; if (i > argc-1) { fprintf(stderr, "Assembly path must be after \"--standalone\" option\n"); @@ -56,14 +57,36 @@ extern "C" int realMain(int argc, char *argv[], const char* mode) } } + if (isManagedAssembly(argv[1]) || isNativeImage(argv[1])) { + corerunMode = true; + } + using tizen::runtime::Launchpad; using tizen::runtime::AppInfo; using tizen::runtime::dotnetcore::CoreRuntime; std::unique_ptr runtime(new CoreRuntime(mode)); - if (standalone) { - _INFO("##### Run it standalone #########"); + if (corerunMode) { + _INFO("##### Run it corerun Mode #########"); + char appId[1024] = {0,}; + std::string appRoot; + snprintf(appId, 16, "%s", "dotnet-launcher"); + appRoot = baseName(argv[1]); + + if (runtime->initialize(true) != 0) { + _ERR("Failed to initialize"); + return 1; + } + + int argsLen = vargs.size(); + char** args = &vargs[0]; + if (runtime->launch(appId, appRoot.c_str(), argv[1], argsLen, args)) { + _ERR("Failed to launch"); + return 1; + } + } else if (standaloneMode) { + _INFO("##### Run it standalone Mode #########"); char appId[1024] = {0,}; std::string appRoot; if (AUL_R_OK == aul_app_get_appid_bypid(getpid(), appId, sizeof(appId))) {