platform/windows/file-helpers-win32.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // RPG Hacker: We can't include that here, because it leads to crazy | ||
| 2 | // errors in windows.h - probably related to our string class?!? | ||
| 3 | //#include "platform/file-helpers.h" | ||
| 4 | |||
| 5 | #if defined(_MSC_VER) | ||
| 6 | # pragma warning(push) | ||
| 7 | # pragma warning(disable : 4668) | ||
| 8 | # pragma warning(disable : 4987) | ||
| 9 | #endif | ||
| 10 | |||
| 11 | #include <windows.h> | ||
| 12 | #include <ctype.h> | ||
| 13 | |||
| 14 | #if defined(_MSC_VER) | ||
| 15 | # pragma warning(pop) | ||
| 16 | #endif | ||
| 17 | |||
| 18 | #include <ctype.h> | ||
| 19 | |||
| 20 | #include "../file-helpers.h" | ||
| 21 | |||
| 22 | 783 | bool file_exists(const char * filename) | |
| 23 | { | ||
| 24 | 783 | return (GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES); | |
| 25 | } | ||
| 26 | |||
| 27 | 1384 | bool path_is_absolute(const char* path) | |
| 28 | { | ||
| 29 | 2144 | return ((isalpha(path[0]) && | |
| 30 | 760 | (':' == path[1]) && (('\\' == path[2]) || ('/' == path[2]))) /* drive letter + root, e.g. C:\dir or C:/dir */ | |
| 31 | 2144 | || ('\\' == path[0]) || ('/' == path[0])); /* just root, e.g. \dir or /dir */ | |
| 32 | } | ||
| 33 | |||
| 34 | 23 | char get_native_path_separator() | |
| 35 | { | ||
| 36 | 23 | return '\\'; | |
| 37 | } | ||
| 38 | |||
| 39 | 235 | bool check_is_regular_file(const char* path) | |
| 40 | { | ||
| 41 | 235 | return !(GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY); | |
| 42 | } | ||
| 43 |