bool TABinaryManager::initTA(const string &uuid) {
LOGD(SIM_DAEMON, "Entry");
- string tapath;
- const char * paths[] = { TEE_TASTORE_ROOT, TEE_EMBEDDED_TASTORE_ROOT, NULL };
+ std::vector<string> paths;
+ paths.push_back(TEE_TASTORE_ROOT);
+ paths.push_back(TEE_EMBEDDED_TASTORE_ROOT);
+ paths.push_back(TEE_TASTORE_ROOT TEE_DOWNLOADED_TA_SUFFIX);
- for (int i = 0; paths[i] != NULL; ++i) {
- if (*paths[i] == '\0') continue; // ignore empty paths
- string path_to_file = paths[i] + uuid;
+ string tapath;
+ for(auto const& p: paths) {
+ if (p.empty()) continue; // ignore empty paths
+ string path_to_file = p + uuid;
boost::system::error_code ec;
if (fs::exists(path_to_file, ec)) {
- tapath = paths[i];
+ tapath = p;
break;
}
}
TAUnpack* unpacker = TAUnpack::getInstance();
bool ret = false;
if (0 == unpacker->unpackTA(tapath, uuid)) {
- LOGD(SIM_DAEMON, "Unpacked, filling info");
+ LOGD(SIM_DAEMON, "Unpacked TA %s from %s", uuid.c_str(), tapath.c_str());
// 1. Set binary info
info.path = tapath + uuid;
info.extractpath = string(TEE_EXTRACT_ROOT) + uuid + "-ext/";