Mercurial > trustbridge
comparison common/portpath.c @ 176:70d627e9e801
New portability function to test if a file is an directory.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Tue, 25 Mar 2014 16:45:32 +0100 |
parents | 3343ddf43f42 |
children | 17e1c8f37d72 |
comparison
equal
deleted
inserted
replaced
175:6fa0e12ae1d2 | 176:70d627e9e801 |
---|---|
58 if (ret == 0) | 58 if (ret == 0) |
59 return true; | 59 return true; |
60 else | 60 else |
61 return false; | 61 return false; |
62 } | 62 } |
63 | |
64 bool | |
65 port_isdir(char *path) | |
66 { | |
67 int ret; | |
68 #ifndef _WIN32 | |
69 struct stat sb; | |
70 ret = stat(path, &sb); | |
71 #else | |
72 struct _stat sb; | |
73 ret = _stat(path, &sb); | |
74 #endif | |
75 | |
76 if ((ret == 0) && S_ISDIR(sb.st_mode)) | |
77 return true; | |
78 else | |
79 return false; | |
80 } |