| 108 | } |
| 109 | |
| 110 | bool fileexists(const char *path, const char *mode) |
| 111 | { |
| 112 | bool exists = true; |
| 113 | if(mode[0]=='w' || mode[0]=='a') path = parentdir(path); |
| 114 | #ifdef WIN32 |
| 115 | if(GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES) exists = false; |
| 116 | #else |
| 117 | if(access(path, R_OK | (mode[0]=='w' || mode[0]=='a' ? W_OK : 0)) == -1) exists = false; |
| 118 | #endif |
| 119 | return exists; |
| 120 | } |
| 121 | |
| 122 | bool createdir(const char *path) |
| 123 | { |
no test coverage detected