forked from TECHME/qqbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfsconfig.ipp
More file actions
35 lines (28 loc) · 798 Bytes
/
fsconfig.ipp
File metadata and controls
35 lines (28 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
static fs::path configfilepath()
{
if ( getenv ( "USERPROFILE" ) ) {
if ( fs::exists ( fs::path ( getenv ( "USERPROFILE" ) ) / ".qqbotrc" ) )
return fs::path ( getenv ( "USERPROFILE" ) ) / ".qqbotrc";
if ( fs::exists ( fs::path ( getenv ( "USERPROFILE" ) ) / "qqbotrc" ) )
return fs::path ( getenv ( "USERPROFILE" ) ) / "qqbotrc";
}
if ( getenv ( "HOME" ) ) {
if ( fs::exists ( fs::path ( getenv ( "HOME" ) ) / ".qqbotrc" ) )
return fs::path ( getenv ( "HOME" ) ) / ".qqbotrc";
}
if ( fs::exists ( "./qqbotrc" ) )
return fs::path ( "./qqbotrc" );
if ( fs::exists ( "/etc/qqbotrc" ) )
return fs::path ( "/etc/qqbotrc" );
throw "not configfileexit";
}
static bool exist_config_file()
{
try {
configfilepath();
return true;
}
catch (...) {
return false;
}
}