return ret;
}
+// Guided by Appfw, vconf daemon does not run at mic stage.
+// So vconf_get_* api does not work normally.
+// Therefore, it provides a second chance to read the file when vconf_get_* is null.
+// /usr/share/dotnet.tizen/lib/dotnet_resolving.info
+static std::string getDotnetResolvingInfo(const char* key)
+{
+ std::ifstream ifs(DOTNET_RESOLVING_INFO_PATH);
+ std::string line;
+ while (std::getline(ifs, line)) {
+ if (!strcmp(line.substr(0, line.find(" ")).c_str(), key)) {
+ ifs.close();
+ return line.substr(line.rfind(" ") + 1);
+ }
+ }
+ _ERR("Faield to get vconf. %s is null", key);
+ return "";
+}
+
static std::vector<std::string> getRidFallbackGraph()
{
+ std::string tizen_rid_version;
+ char* tizen_rid_version_value = vconf_get_str(__TIZEN_RID_VERSION_KEY);
+ if (!tizen_rid_version_value) {
+ _INFO("Faield to get vconf. So, Read the dotnet_resolving.info file");
+ tizen_rid_version = getDotnetResolvingInfo(__TIZEN_RID_VERSION_KEY);
+ } else {
+ tizen_rid_version = std::string(tizen_rid_version_value);
+ free(tizen_rid_version_value);
+ }
+
+ std::vector<std::string> rid_version;
std::vector<std::string> RID_FALLBACK_GRAPH;
- char* tizen_rid_version = vconf_get_str(__TIZEN_RID_VERSION_KEY);
- if (tizen_rid_version) {
- std::vector<std::string> rid_version;
- splitPath(tizen_rid_version, rid_version);
- std::reverse(std::begin(rid_version), std::end(rid_version));
- for (auto& ridVersion : rid_version) {
- //.NET 6.0 is supported from Tizen 6.5.0
- if (convertStrVersionToInt(ridVersion) >= 650) {
- platform_version_list.push_back(ridVersion.substr(0, ridVersion.rfind('.')));
- }
- RID_FALLBACK_GRAPH.push_back(std::string("tizen." + ridVersion + "-" + ARCHITECTURE_IDENTIFIER));
- RID_FALLBACK_GRAPH.push_back(std::string("tizen." + ridVersion));
+ splitPath(tizen_rid_version, rid_version);
+ std::reverse(std::begin(rid_version), std::end(rid_version));
+ for (auto& ridVersion : rid_version) {
+ //.NET 6.0 is supported from Tizen 6.5.0
+ if (convertStrVersionToInt(ridVersion) >= 650) {
+ platform_version_list.push_back(ridVersion.substr(0, ridVersion.rfind('.')));
}
- free(tizen_rid_version);
+ RID_FALLBACK_GRAPH.push_back(std::string("tizen." + ridVersion + "-" + ARCHITECTURE_IDENTIFIER));
+ RID_FALLBACK_GRAPH.push_back(std::string("tizen." + ridVersion));
}
std::vector<std::string> RID_FALLBACK_OS = {"tizen", "linux", "unix"};
static std::vector<std::string> getTfmFallbackGraph()
{
+ std::string dotnet_runtime_version;
+ char* dotnet_runtime_version_value = vconf_get_str(__DOTNET_RUNTIME_VERSION_KEY);
+ if (!dotnet_runtime_version_value) {
+ _INFO("Faield to get vconf. So, Read the dotnet_resolving.info file");
+ dotnet_runtime_version = getDotnetResolvingInfo(__DOTNET_RUNTIME_VERSION_KEY);
+ } else {
+ dotnet_runtime_version = std::string(dotnet_runtime_version_value);
+ free(dotnet_runtime_version_value);
+ }
+
std::vector<std::string> tfm_list;
- char* dotnet_runtime_version = vconf_get_str(__DOTNET_RUNTIME_VERSION_KEY);
- if (dotnet_runtime_version) {
- std::vector<std::string> dotnet_version;
- splitPath(dotnet_runtime_version, dotnet_version);
- for (auto& dotnetVersion : dotnet_version) {
- for (auto& platformVersion : platform_version_list) {
- tfm_list.push_back(std::string("net" + dotnetVersion + "-tizen" + platformVersion));
- }
- tfm_list.push_back(std::string("net" + dotnetVersion + "-tizen"));
- tfm_list.push_back(std::string("net" + dotnetVersion));
+ std::vector<std::string> dotnet_version;
+ splitPath(dotnet_runtime_version, dotnet_version);
+ for (auto& dotnetVersion : dotnet_version) {
+ for (auto& platformVersion : platform_version_list) {
+ tfm_list.push_back(std::string("net" + dotnetVersion + "-tizen" + platformVersion));
}
- free(dotnet_runtime_version);
+ tfm_list.push_back(std::string("net" + dotnetVersion + "-tizen"));
+ tfm_list.push_back(std::string("net" + dotnetVersion));
}
- char* tizen_tfm = vconf_get_str(__TIZEN_TFM_SUPPORT_KEY);
- if (tizen_tfm) {
- splitPath(tizen_tfm, tfm_list);
- free(tizen_tfm);
+ std::string tizen_tfm;
+ char* tizen_tfm_value = vconf_get_str(__TIZEN_TFM_SUPPORT_KEY);
+ if (!tizen_tfm_value) {
+ _INFO("Faield to get vconf. So, Read the dotnet_resolving.info file");
+ tizen_tfm = getDotnetResolvingInfo(__TIZEN_TFM_SUPPORT_KEY);
+ } else {
+ tizen_tfm = std::string(tizen_tfm_value);
+ free(tizen_tfm_value);
}
+ splitPath(tizen_tfm, tfm_list);
tfm_list.push_back("net5.0");
std::vector<std::string> netcoreapp_version = {"3.1", "3.0", "2.2", "2.1", "2.0", "1.1", "1.0"};