Skip to content

Commit

Permalink
Merge pull request #422 from sanderpuh/Follow-DCF-standard-for-media-…
Browse files Browse the repository at this point in the history
…storage-(DVR)

Subdirectory support for disk_checkPath()
  • Loading branch information
ligenxxxx authored Jun 7, 2024
2 parents dc571ac + 05981d1 commit 7ad5d4c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/record/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <dirent.h>
#include <fcntl.h>
#include <pthread.h>
#include <libgen.h>

#include <log/log.h>

Expand Down Expand Up @@ -145,7 +146,13 @@ bool disk_checkPath(char* sPath)
stat(sPath, &st);
if(!S_ISDIR(st.st_mode))
{
mkdir(sPath, 0777);
char command[128];
snprintf(command, sizeof(command), "mkdir -p %s && chmod -R 777 $(dirname %s)", sPath, sPath);
int ret = system(command);

if (ret != 0) {
return false;
}

memset(&st, 0, sizeof(st));
stat(sPath, &st);
Expand Down

0 comments on commit 7ad5d4c

Please sign in to comment.