replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / security / unittest / srmtestcommon.cpp
index 5bfe64e..9eb7096 100644 (file)
@@ -143,11 +143,20 @@ bool ReadCBORFile(const char* filename, const char* rsrcname, uint8_t **payload,
     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;