equal
deleted
inserted
replaced
|
1 #ifndef VMAILMGR__STAT_FNS__H__ |
|
2 #define VMAILMGR__STAT_FNS__H__ |
|
3 |
|
4 #include <sys/stat.h> |
|
5 #include <unistd.h> |
|
6 |
|
7 inline bool is_exist(const char* filename) |
|
8 { |
|
9 struct stat buf; |
|
10 return !stat(filename, &buf); |
|
11 } |
|
12 |
|
13 inline bool is_dir(const char* filename) |
|
14 { |
|
15 struct stat buf; |
|
16 return !stat(filename, &buf) && S_ISDIR(buf.st_mode); |
|
17 } |
|
18 |
|
19 inline bool is_symlink(const char* filename) |
|
20 { |
|
21 struct stat buf; |
|
22 return !lstat(filename, &buf) && S_ISLNK(buf.st_mode); |
|
23 } |
|
24 |
|
25 inline bool is_file(const char* filename) |
|
26 { |
|
27 struct stat buf; |
|
28 return !stat(filename, &buf) && S_ISREG(buf.st_mode); |
|
29 } |
|
30 |
|
31 #endif |