| 196 | } |
| 197 | |
| 198 | txString fxRealFilePathIf(txParser* parser, txString path) |
| 199 | { |
| 200 | #if mxWindows |
| 201 | char buffer[C_PATH_MAX]; |
| 202 | DWORD attributes; |
| 203 | if (_fullpath(buffer, path, C_PATH_MAX) != NULL) { |
| 204 | attributes = GetFileAttributes(buffer); |
| 205 | if ((attributes != 0xFFFFFFFF) && (!(attributes & FILE_ATTRIBUTE_DIRECTORY))) { |
| 206 | return fxNewParserString(parser, buffer, mxStringLength(buffer)); |
| 207 | } |
| 208 | } |
| 209 | #else |
| 210 | char buffer[C_PATH_MAX]; |
| 211 | struct stat a_stat; |
| 212 | if (realpath(path, buffer) != NULL) { |
| 213 | if (stat(buffer, &a_stat) == 0) { |
| 214 | if (S_ISREG(a_stat.st_mode)) { |
| 215 | return fxNewParserString(parser, buffer, mxStringLength(buffer)); |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | #endif |
| 220 | return NULL; |
| 221 | } |
| 222 | |
| 223 | |
| 224 | void fxWriteBuffer(txScript* script, FILE* file, txString name, txU1* buffer, txSize size) |
no test coverage detected