remove getenv 78/139578/2 accepted/tizen/unified/20170720.062142 submit/tizen/20170720.005404
authorCho Woong Suk <ws77.cho@samsung.com>
Wed, 19 Jul 2017 10:47:31 +0000 (19:47 +0900)
committerJongHeon Choi <j-h.choi@samsung.com>
Thu, 20 Jul 2017 00:39:44 +0000 (00:39 +0000)
Change-Id: Ia1c1c021ba8d31060643d44bf94aa6928761e957

NativeLauncher/launcher/dotnet/dotnet_launcher.cc
NativeLauncher/launcher/main.cc
NativeLauncher/util/utils.cc

index 6724558..6adff4b 100644 (file)
@@ -112,21 +112,6 @@ int CoreRuntime::initialize(bool standalone)
        putenv(const_cast<char *>("UNW_ARM_UNWIND_METHOD=6"));
 #endif // __arm__
 
-       if (standalone) {
-               const char *deviceApiDirectory = getenv("__deviceAPIDirectory");
-               const char *runtimeDirectory = getenv("__runtimeDirectory");
-               if (deviceApiDirectory != nullptr)
-                       __deviceAPIDirectory = deviceApiDirectory;
-               if (runtimeDirectory != nullptr)
-                       __runtimeDirectory = runtimeDirectory;
-
-#ifdef USE_MANAGED_LAUNCHER
-               const char *launcherAssembly = getenv("__launcherAssembly");
-               if (launcherAssembly != nullptr)
-                       __launcherAssembly = launcherAssembly;
-#endif
-       }
-
        if (__deviceAPIDirectory.empty()) {
                _ERR("Empty Device API Directory");
                return 1;
index c23e16f..b5e566c 100644 (file)
@@ -25,6 +25,8 @@
 #include <Ecore.h>
 #include <Eina.h>
 #include <aul.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #define __XSTR(x) #x
 #define __STR(x) __XSTR(x)
@@ -76,19 +78,20 @@ int main(int argc, char *argv[])
 
        if (standalone) {
                _DBG("##### Run it standalone #########");
-               const char* appId = getenv("AUL_APPID");
-               _DBG("AUL_APPID : %s", appId);
+               char appId[1024] = {0,};
                std::string appRoot;
-               if (appId != nullptr) {
+               if (AUL_R_OK == aul_app_get_appid_bypid(getpid(), appId, sizeof(appId))) {
                        const char* appRootPath = aul_get_app_root_path();
                        if (appRootPath != nullptr)
                                appRoot = std::string(appRootPath);
                } else {
-                       appId = "dotnet-launcher";
+                       // If appId is not set, it is executed directly by cmdline.
+                       // In this case, appRoot is passed as an argument.
+                       snprintf(appId, 16, "%s", "dotnet-launcher");
+                       appRoot = baseName(baseName(standalonePath));
                }
+               _DBG("AUL_APPID : %s", appId);
 
-               if (appRoot.empty())
-                       appRoot = baseName(baseName(standalonePath));
                if (runtime->initialize(true) != 0) {
                        _ERR("Failed to initialize");
                        return 1;
index d5cf5d3..92440f1 100644 (file)
@@ -145,6 +145,7 @@ static bool extCheckAndGetFileNameIfExist(const std::string& dir, const std::str
        if (fName.length() < ext.length() ||
                        fHame.compare(fName.length() - ext.length(), ext.length(), ext) != 0) {
                return false;
+       }
 
        std::string fullName = concatPath(dir, entry->d_name);
        switch (entry->d_type) {