* Include files
*-----------------------------------------------------------------------------*/
#include "TABinaryManager.h"
+#include "Config.h"
#include <iostream>
#include <fstream>
#include <stdio.h>
}
/**
- * This function add TA at given path to BinaryManager if it exists.
+ * This function add TA to BinaryManager if it exists.
* @return On successful completion of above operations returns true else false.
*/
-bool TABinaryManager::initTAatPath(const string &path, const string &uuid) {
+bool TABinaryManager::initTA(const string &uuid) {
LOGD(SIM_DAEMON, "Entry");
pthread_rwlock_wrlock(&binaryMapLock);
bool res = false;
StructBinaryInfo info;
- if (boost::filesystem::exists(path + uuid)) {
+ if (boost::filesystem::exists(TA_STORE_PATH + uuid)) {
pthread_mutex_lock(&taLock);
try {
- if (unpackBinary(uuid, path, info)) {
+ if (unpackBinary(uuid, info)) {
binaryMap[uuid] = info;
res = true;
}
* It is very important to check for return value from this function.
*/
-bool TABinaryManager::unpackBinary(const string &uuid, const string &path, StructBinaryInfo& info) {
+bool TABinaryManager::unpackBinary(const string &uuid, StructBinaryInfo& info) {
TAUnpack* unpacker = TAUnpack::getInstance();
bool ret = false;
- LOGD(SIM_DAEMON, "Unpacking TA %s in %s", uuid.c_str(), path.c_str());
- if (0 == unpacker->unpackTA(path, uuid)) {
+ if (0 == unpacker->unpackTA(string(TA_STORE_PATH), uuid)) {
LOGD(SIM_DAEMON, "Unpacked, filling info");
// 1. Set binary info
- info.path = path + uuid;
- info.extractpath = path + uuid + "-ext/";
+ info.path = string(TA_STORE_PATH)+ uuid;
+ info.extractpath = string(TA_STORE_PATH) + uuid + "-ext/";
info.imagePath = info.extractpath + uuid + ".image";
info.manifestPath = info.extractpath + uuid + ".manifest";
// 2. Parse manifest and store results