From 18c9b74ff0022ff7f0529aa08be7cb58d6b30c12 Mon Sep 17 00:00:00 2001 From: Koichiro IWAO Date: Fri, 29 Nov 2019 22:31:06 +0900 Subject: [PATCH] implement Get{Db,Log,Pid}{,W} function DbDir : directory to store files such as vpn_server.config and backups etc LogDir : directory to write logs (sub directories is created in this dir) PidDir : directory to put PID files such as .ctl-* .pid-* .VPN-* --- src/Mayaqua/FileIO.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ src/Mayaqua/FileIO.h | 6 +++++ 2 files changed, 60 insertions(+) diff --git a/src/Mayaqua/FileIO.c b/src/Mayaqua/FileIO.c index 2868de18..7b863017 100644 --- a/src/Mayaqua/FileIO.c +++ b/src/Mayaqua/FileIO.c @@ -1295,6 +1295,60 @@ void GetExeNameW(wchar_t *name, UINT size) UniStrCpy(name, size, exe_file_name_w); } +void GetLogDir(char *name, UINT size) +{ +#ifdef SE_LOGDIR + Format(name, size, SE_LOGDIR); +#else + GetExeDir(name, size); +#endif +} + +void GetLogDirW(wchar_t *name, UINT size) +{ +#ifdef SE_LOGDIR + UniFormat(name, size, L""SE_LOGDIR); +#else + GetExeDirW(name, size); +#endif +} + +void GetDbDir(char *name, UINT size) +{ +#ifdef SE_DBDIR + Format(name, size, SE_DBDIR); +#else + GetExeDir(name, size); +#endif +} + +void GetDbDirW(wchar_t *name, UINT size) +{ +#ifdef SE_DBDIR + UniFormat(name, size, L""SE_DBDIR); +#else + GetExeDirW(name, size); +#endif +} + +void GetPidDir(char *name, UINT size) +{ +#ifdef SE_PIDDIR + Format(name, size, SE_PIDDIR); +#else + GetExeDir(name, size); +#endif +} + +void GetPidDirW(wchar_t *name, UINT size) +{ +#ifdef SE_PIDDIR + UniFormat(name, size, L""SE_PIDDIR); +#else + GetExeDirW(name, size); +#endif +} + // Initialization of the acquisition of the EXE file name void InitGetExeName(char *arg) { diff --git a/src/Mayaqua/FileIO.h b/src/Mayaqua/FileIO.h index 436aabe7..3233ce00 100644 --- a/src/Mayaqua/FileIO.h +++ b/src/Mayaqua/FileIO.h @@ -228,6 +228,12 @@ void GetExeName(char *name, UINT size); void GetExeNameW(wchar_t *name, UINT size); void GetExeDir(char *name, UINT size); void GetExeDirW(wchar_t *name, UINT size); +void GetLogDir(char *name, UINT size); +void GetLogDirW(wchar_t *name, UINT size); +void GetDbDir(char *name, UINT size); +void GetDbDirW(wchar_t *name, UINT size); +void GetPidDir(char *name, UINT size); +void GetPidDirW(wchar_t *name, UINT size); void BuildHamcore(char *dst_filename, char *src_dir, bool unix_only); int CompareHamcore(void *p1, void *p2); void InitHamcore();