mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-01 22:58:44 -04:00
opt: use sysconfigdir to get install path
This commit is contained in:
parent
98413aa01b
commit
28d19fdbc8
2 changed files with 39 additions and 27 deletions
|
|
@ -3,6 +3,10 @@
|
|||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef SYSCONFDIR
|
||||
#define SYSCONFDIR "/etc"
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
const char *id;
|
||||
const char *title;
|
||||
|
|
@ -1024,7 +1028,7 @@ void parse_config(void) {
|
|||
// 检查文件是否存在
|
||||
if (access(filename, F_OK) != 0) {
|
||||
// 如果文件不存在,则使用 /etc/maomao/config.conf
|
||||
snprintf(filename, sizeof(filename), "/etc/maomao/config.conf");
|
||||
snprintf(filename, sizeof(filename), "%s/maomao/config.conf",SYSCONFDIR);
|
||||
}
|
||||
} else {
|
||||
// 使用 MAOMAOCONFIG 环境变量作为配置文件夹路径
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue