From: Woongsuk Cho Date: Tue, 17 Jul 2018 00:22:03 +0000 (+0900) Subject: set environment for debugging by env_list X-Git-Tag: accepted/tizen/unified/20180802.134837~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bdd1da454cb02179f38995c0f2df0bf2c1e9f399;p=platform%2Fcore%2Fdotnet%2Flauncher.git set environment for debugging by env_list Change-Id: If360563f29bb7ec6ff336d318fea2e361bfb3549 --- diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc index 676029c..d11c8f0 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,7 @@ #include "log_manager.h" #define PLUGIN_PATH "/usr/share/dotnet.tizen/lib/libdotnet_plugin.so" +#define ENV_FILE_PATH "/usr/share/dotnet.tizen/lib/coreclr_env.list" namespace tizen { namespace runtime { @@ -83,6 +85,37 @@ static std::string getExtraNativeLibDirs(const std::string& appRoot) return candidate; } + +static std::vector __envList; + +static void setEnvFromFile() +{ + std::string envList; + std::ifstream inFile(ENV_FILE_PATH); + + __envList.clear(); + + if (inFile) { + _INFO("coreclr_env.list is found"); + inFile >> envList; + + std::istringstream ss(envList); + std::string token; + + while (std::getline(ss, token, ':')) { + if (!token.empty()) { + __envList.push_back(token); + } + } + + for (unsigned int i = 0; i < __envList.size(); i++) { + putenv(const_cast(__envList[i].c_str())); + } + } else { + _INFO("coreclr_env.list file is not found. skip"); + } +} + CoreRuntime::CoreRuntime(const char* mode) : initializeClr(nullptr), executeAssembly(nullptr), @@ -136,6 +169,9 @@ int CoreRuntime::initialize(bool standalone) putenv(const_cast("UNW_ARM_UNWIND_METHOD=6")); #endif // __arm__ + // read string from external file and set them to environment value. + setEnvFromFile(); + if (initializePathManager(std::string(), std::string(), std::string()) < 0) { _ERR("Failed to initialize PathManager"); return -1; @@ -267,6 +303,8 @@ void CoreRuntime::dispose() finalizePluginManager(); finalizePathManager(); + __envList.clear(); + _DBG("Dotnet runtime disposed"); }