From 898b1b5887c4464689b845f765c1a1a686e7faa2 Mon Sep 17 00:00:00 2001 From: Woongsuk Cho Date: Fri, 10 Aug 2018 11:13:59 +0900 Subject: [PATCH] add corerun mode Change-Id: Ie53cbae5da2d2f18dacb23822ce359490351b5ea --- NativeLauncher/launcher/main.cc | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/NativeLauncher/launcher/main.cc b/NativeLauncher/launcher/main.cc index 6c1ac12..5464247 100644 --- a/NativeLauncher/launcher/main.cc +++ b/NativeLauncher/launcher/main.cc @@ -45,8 +45,9 @@ static std::string StandaloneOption("--standalone"); int main(int argc, char *argv[]) { int i; - bool standalone = false; + bool standaloneMode = false; char* standalonePath = nullptr; + bool corerunMode = false; std::vector vargs; @@ -56,7 +57,7 @@ int main(int argc, char *argv[]) printf("Dotnet launcher Version %s\n", LAUNCHER_VERSION_STR); return 0; } else if (StandaloneOption.compare(argv[i]) == 0) { - standalone = true; + standaloneMode = true; if (i > argc-1) { fprintf(stderr, "Assembly path must be after \"--standalone\" option\n"); @@ -69,6 +70,10 @@ int main(int argc, char *argv[]) } } + if (isManagedAssembly(argv[1])) { + corerunMode = true; + } + using tizen::runtime::LauncherInterface; using tizen::runtime::Launchpad; using tizen::runtime::AppInfo; @@ -78,8 +83,26 @@ int main(int argc, char *argv[]) std::unique_ptr coreRuntime(new CoreRuntime()); runtime = std::move(coreRuntime); - if (standalone) { - _DBG("##### Run it standalone #########"); + if (corerunMode) { + _DBG("##### 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) { + _DBG("##### Run it standalone Mode #########"); char appId[1024] = {0,}; std::string appRoot; if (AUL_R_OK == aul_app_get_appid_bypid(getpid(), appId, sizeof(appId))) { -- 2.7.4