From: Cho Woong Suk Date: Wed, 19 Jul 2017 10:47:31 +0000 (+0900) Subject: remove getenv X-Git-Tag: accepted/tizen/unified/20170720.062142^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F78%2F139578%2F2;p=platform%2Fcore%2Fdotnet%2Flauncher.git remove getenv Change-Id: Ia1c1c021ba8d31060643d44bf94aa6928761e957 --- diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc index 6724558..6adff4b 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc @@ -112,21 +112,6 @@ int CoreRuntime::initialize(bool standalone) putenv(const_cast("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; diff --git a/NativeLauncher/launcher/main.cc b/NativeLauncher/launcher/main.cc index c23e16f..b5e566c 100644 --- a/NativeLauncher/launcher/main.cc +++ b/NativeLauncher/launcher/main.cc @@ -25,6 +25,8 @@ #include #include #include +#include +#include #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; diff --git a/NativeLauncher/util/utils.cc b/NativeLauncher/util/utils.cc index d5cf5d3..92440f1 100644 --- a/NativeLauncher/util/utils.cc +++ b/NativeLauncher/util/utils.cc @@ -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) {