Seperate the pluginDir and extraDir from the path manager (#252)
author최종헌/Common Platform Lab(SR)/Engineer/삼성전자 <j-h.choi@samsung.com>
Mon, 29 Jun 2020 21:52:29 +0000 (06:52 +0900)
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>
Mon, 29 Jun 2020 21:52:29 +0000 (06:52 +0900)
Change-Id: If710a702feaaa4e1e9047c346c9a656920dcb921

NativeLauncher/util/path_manager.cc

index 3d73528..d89b84e 100644 (file)
@@ -37,7 +37,8 @@ typedef struct DllPath {
        std::string runtime_dir;
        std::string tizenfx_dir;
        std::string tizenfx_ref_dir;
-       std::vector <std::string>extra_dirs;
+       std::vector<std::string> extra_dirs;
+       std::vector<std::string> plugin_dirs;
 } DllPath;
 
 static DllPath* __dllPath = nullptr;
@@ -82,11 +83,11 @@ int initializePathManager(const std::string& runtimeDir, const std::string& tize
        // ":" seperated extra directories
        if (!extraDir.empty()) {
                splitPath(extraDir, __dllPath->extra_dirs);
-       } else {
-               char* extraPath = pluginGetDllPath();
-               if (extraPath) {
-                       splitPath(extraPath, __dllPath->extra_dirs);
-               }
+       }
+
+       char* pluginPath = pluginGetDllPath();
+       if (pluginPath) {
+               splitPath(pluginPath, __dllPath->plugin_dirs);
        }
 
        _INFO("Path manager initialize success");
@@ -97,6 +98,7 @@ int initializePathManager(const std::string& runtimeDir, const std::string& tize
 
 void finalizePathManager()
 {
+       _INFO("Path manager finalize called");
        if (__dllPath) {
                delete __dllPath;
                __dllPath = NULL;
@@ -120,11 +122,16 @@ std::string getTizenFXRefDir()
        return __dllPath->tizenfx_ref_dir;
 }
 
-std::vector <std::string> getExtraDirs()
+std::vector<std::string> getExtraDirs()
 {
        return __dllPath->extra_dirs;
 }
 
+std::vector<std::string> getPluginDirs()
+{
+       return __dllPath->plugin_dirs;
+}
+
 static std::string getPlatformTPA()
 {
        std::string platform_tpa;
@@ -137,6 +144,7 @@ static std::string getPlatformTPA()
                cacheFile.close();
        } else {
                std::vector<std::string> tpaDirs = { getRuntimeDir(), getTizenFXDir(), getTizenFXRefDir() };
+               tpaDirs.insert(tpaDirs.end(), getExtraDirs().begin(), getExtraDirs().end());
                addAssembliesFromDirectories(tpaDirs, platform_tpa);
        }
 
@@ -146,14 +154,13 @@ static std::string getPlatformTPA()
 static std::string getPluginTPA()
 {
        std::string plugin_tpa;
-
        char* plugin_tpa_list = pluginGetTPA();
        if (plugin_tpa_list) {
                _INFO("plugin TPA list found. use TPA list for plugin");
                plugin_tpa = plugin_tpa_list;
-       } else if (!__dllPath->extra_dirs.empty()) {
-               _INFO("plugin extra directory found. use plugin extra directroy for TPA");
-               addAssembliesFromDirectories(__dllPath->extra_dirs, plugin_tpa);
+       } else if (!getPluginDirs().empty()) {
+               _INFO("Plugin directory found. use plugin directroy for TPA");
+               addAssembliesFromDirectories(getPluginDirs(), plugin_tpa);
        }
 
        return plugin_tpa;