Skip to content
Snippets Groups Projects
Commit 9bbba680 authored by Hauke Mehrtens's avatar Hauke Mehrtens
Browse files

BLE: FileTrans: Use full path when creating dir


We have to use the full path when we create a new directory.

Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
parent fb1a385c
No related branches found
No related tags found
No related merge requests found
......@@ -237,8 +237,11 @@ static int bleFileCreateOrOpen(char *filepath)
{
char *path;
char *fileName = NULL;
char filecreate[100];
int ret;
filecreate[0] = 0;
while (true) {
path = strtok(filepath, "/");
filepath = NULL;
......@@ -250,14 +253,23 @@ static int bleFileCreateOrOpen(char *filepath)
return -EINVAL;
if (fileName) {
ret = epic_file_mkdir(fileName);
if (ret)
ret = epic_file_stat(filecreate, NULL);
if (ret) {
ret = epic_file_mkdir(filecreate);
if (ret) {
printf("mkdir failed: %s, ret: %i\n",
filecreate,
ret);
return ret;
}
}
}
fileName = path;
strncat(filecreate, "/", sizeof(filecreate) - 1);
strncat(filecreate, path, sizeof(filecreate) - 1);
}
return epic_file_open(filepath, "w");
return epic_file_open(filecreate, "w");
}
static uint8_t bleFileOpen(dmConnId_t connId, uint8_t *pValue, uint16_t len)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment