[Tizen S] Integrate app types(dotnet, dotnet-nui)
[platform/core/dotnet/launcher.git] / NativeLauncher / launcher / exec / launcher.cc
index e52001e..d7cc8e6 100644 (file)
@@ -36,17 +36,24 @@ using tizen::runtime::dotnetcore::CoreRuntime;
 #define APPID_MAX_LENGTH       (25 + 105)
 #define PRC_NAME_LENGTH                16
 
+static const char* KEY_TIZEN_UIFW = "TIZEN_UIFW";
 static std::string StandaloneOption("--standalone");
 static std::string PaddingOption("--PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE_PADDING_TO_CHANGE_CMDLINE");
 static std::string AppTypeOption("--appType");
+static std::string UIFWOption(KEY_TIZEN_UIFW);
+static std::string ProfileOption("--profile");
+static std::string GlobalizationInvariantOption("--invariant");
 
 int main(int argc, char *argv[])
 {
+       printHWClockLog("[dotnet-launcher] launcher main!");
        _INFO("##### Run in standalone mode #####");
 
        char* standalonePath = nullptr;
        bool paddingExist = false;
-       const char* appType = NULL;
+       bool profile = false;
+       const char* appType = "dotnet";
+       const char* UIFWType = "NUI";
        const char* appRootPath = NULL;
        char appId[APPID_MAX_LENGTH] = {0,};
 
@@ -54,31 +61,40 @@ int main(int argc, char *argv[])
 
        // start index 1 to avoid passing executable name "dotnet-launcher" as a parameter
        for (int i = 1; i < argc; i++) {
-               if (StandaloneOption.compare(argv[i]) == 0) {
+
+               if (GlobalizationInvariantOption.compare(argv[i]) == 0) {
+                       setenv("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", "1", 1);
+                       setenv("DOTNET_SYSTEM_GLOBALIZATION_PREDEFINED_CULTURES_ONLY", "false", 1);
+               } else if (StandaloneOption.compare(argv[i]) == 0) {
                        if (i > argc - 1) {
-                               _ERR("Assembly path must be after \"--standalone\" option");
+                               _ERR("Assembly path must be after %s option", StandaloneOption.c_str());
                                return -1;
                        }
                        i++;
                        standalonePath = argv[i];
                } else if (PaddingOption.compare(argv[i]) == 0) {
                        paddingExist = true;
+               } else if (ProfileOption.compare(argv[i]) == 0) {
+                       profile = true;
                } else if (AppTypeOption.compare(argv[i]) == 0) {
                        if (i > argc - 1) {
-                               _ERR("app type for launchpad must be after \"--appType\" option");
+                               _ERR("app type for launchpad must be after %s option", AppTypeOption.c_str());
                                return -1;
                        }
                        i++;
                        appType = argv[i];
+               } else if (UIFWOption.compare(argv[i]) == 0) {
+                       if (i > argc - 1) {
+                               _ERR("UIFW type for launchpad must be after %s option", UIFWOption.c_str());
+                               return -1;
+                       }
+                       i++;
+                       UIFWType = argv[i];
                } else {
                        vargs.push_back(argv[i]);
                }
        }
 
-       if (appType == NULL) {
-               appType = "dotnet";
-       }
-
        // get app ID and app root path
        if (AUL_R_OK == aul_app_get_appid_bypid(getpid(), appId, sizeof(appId))) {
                _INFO("AUL_APPID : %s", appId);
@@ -101,13 +117,16 @@ int main(int argc, char *argv[])
        memset(argv[0], '\0', cmdlineSize);
        snprintf(argv[0], cmdlineSize - 1, "%s", standalonePath);
 
+       setenv(KEY_TIZEN_UIFW, UIFWType, 1);
+       _INFO("TIZEN_UIFW is set to %s", UIFWType);
+
        // initialize CoreRuntime
        int err = CoreRuntime::initialize(appType, LaunchMode::launcher);
        if (err) {
                _ERR("Failed to initialize");
        } else {
                // launch application
-               err = CoreRuntime::launch(appId, appRootPath, standalonePath, vargs.size(), &vargs[0]);
+               err = CoreRuntime::launch(appId, appRootPath, standalonePath, vargs.size(), &vargs[0], profile);
                if (err) {
                        _ERR("Failed to launch");
                }