mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Add --log-directory option
For specifying directory path in which to save automatically named log files.
This commit is contained in:
parent
83f826349b
commit
70913fe120
7 changed files with 65 additions and 7 deletions
17
src/misc.c
17
src/misc.c
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue