#include <iterator>
#include <sstream>
#include <vconf.h>
+#include <fstream>
#include "utils.h"
#include "plugin_manager.h"
#include "log.h"
static const char* __TIZEN_API_PATH_KEY = "db/dotnet/tizen_api_path";
+static const char* PLATFORM_TPA_CACHE = "/usr/share/dotnet.tizen/lib/platform_tpa_cache";
#define __XSTR(x) #x
#define __STR(x) __XSTR(x)
return __dllPath->extra_dirs;
}
+static std::string getPlatformTPA()
+{
+ std::string platform_tpa;
+
+ if (isFileExist(PLATFORM_TPA_CACHE)) {
+ _INFO("platform tpa cache found.\n");
+ std::ifstream cacheFile;
+ cacheFile.open(PLATFORM_TPA_CACHE);
+ std::getline(cacheFile, platform_tpa);
+ cacheFile.close();
+ } else {
+ std::vector<std::string> tpaDir;
+ tpaDir.push_back(getRuntimeDir());
+ tpaDir.push_back(getTizenFXDir());
+ tpaDir.push_back(getTizenFXRefDir());
+ assembliesInDirectory(tpaDir, platform_tpa);
+ }
+
+ return platform_tpa;
+}
+
+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");
+ assembliesInDirectory(__dllPath->extra_dirs, plugin_tpa);
+ }
+
+ return plugin_tpa;
+}
+
std::string getTPA()
{
if (!__tpa.empty()) {
return __tpa;
}
- std::vector<std::string> tpaDir;
-
if (__dllPath == NULL) {
return std::string("");
}
- tpaDir.push_back(getRuntimeDir());
- tpaDir.push_back(getTizenFXDir());
- tpaDir.push_back(getTizenFXRefDir());
- tpaDir.insert(tpaDir.end(), __dllPath->extra_dirs.begin(), __dllPath->extra_dirs.end());
- assembliesInDirectory(tpaDir, __tpa);
-
- return __tpa;
+ return getPlatformTPA() + ":" + getPluginTPA();
}