#define STRINGIZE(x) STRINGIZE2(x)
// TODO: Remove this, once all cbor related are completed.
-char* ReadFile(const char* filename)
+char* ReadFileToBuffer(const char* filename)
{
FILE *fp = NULL;
return status;
}
+static FILE* utopen(const char *filename, const char *mode)
+{
+ int len = strlen(STRINGIZE(SECURITY_BUILD_UNITTEST_DIR)) + strlen(filename) + 1;
+ char filepath[1024] = {0};
+ int ret = snprintf(filepath, len, "%s%s", STRINGIZE(SECURITY_BUILD_UNITTEST_DIR), filename);
+ printf("Root build path: %s \n", filepath);
+ return fopen(filepath, mode);
+}
+
void SetPersistentHandler(OCPersistentStorage *ps, bool set)
{
if (set)
{
- ps->open = fopen;
+ ps->open = utopen;
ps->read = fread;
ps->write = fwrite;
ps->close = fclose;