diff options
author | Eden Lee <bw1212.lee@samsung.com> | 2018-07-26 06:19:55 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.ap-northeast-2.compute.internal> | 2018-07-26 06:19:55 +0000 |
commit | f497090e1d52589c7bd99fe726551f1c6bb05093 (patch) | |
tree | 24cad064fd59eb3c5bf5ba4851f7926943fced04 | |
parent | f58c74485e04f04fbf43edae2c8e039a3e70eef2 (diff) | |
parent | bdd1da454cb02179f38995c0f2df0bf2c1e9f399 (diff) | |
download | launcher-f497090e1d52589c7bd99fe726551f1c6bb05093.tar.gz launcher-f497090e1d52589c7bd99fe726551f1c6bb05093.tar.bz2 launcher-f497090e1d52589c7bd99fe726551f1c6bb05093.zip |
Merge "set environment for debugging by env_list" into tizen
-rw-r--r-- | NativeLauncher/launcher/dotnet/dotnet_launcher.cc | 38 |
1 files changed, 38 insertions, 0 deletions
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 <string> #include <fstream> #include <vector> +#include <sstream> #include <fcntl.h> #include <sys/stat.h> @@ -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<std::string> __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<char *>(__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<char *>("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"); } |