Add --log-directory option

For specifying directory path in which to save automatically named log
files.
This commit is contained in:
Martin Lund 2024-04-04 12:31:39 +02:00
parent 83f826349b
commit 70913fe120
7 changed files with 65 additions and 7 deletions

View file

@ -24,6 +24,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/stat.h>
#include <time.h>
#include <errno.h>
#include "error.h"
@ -70,3 +71,19 @@ int ctrl_key_code(unsigned char key)
return -1;
}
bool fs_dir_exists(const char *path)
{
struct stat st;
if (stat(path, &st) != 0)
{
return false;
}
else if (!S_ISDIR(st.st_mode))
{
return false;
}
return true;
}