* hb_fopen ************************************************************************ * Wrapper to the real fopen, needed to handle utf8 filenames on * windows. ***********************************************************************/
| 828 | * windows. |
| 829 | ***********************************************************************/ |
| 830 | FILE * hb_fopen(const char *path, const char *mode) |
| 831 | { |
| 832 | #ifdef SYS_MINGW |
| 833 | FILE *f; |
| 834 | wchar_t path_utf16[MAX_PATH]; |
| 835 | wchar_t mode_utf16[16]; |
| 836 | if (!MultiByteToWideChar(CP_UTF8, 0, path, -1, path_utf16, MAX_PATH)) |
| 837 | return NULL; |
| 838 | if (!MultiByteToWideChar(CP_UTF8, 0, mode, -1, mode_utf16, 16)) |
| 839 | return NULL; |
| 840 | errno_t ret = _wfopen_s(&f, path_utf16, mode_utf16); |
| 841 | if (ret) |
| 842 | return NULL; |
| 843 | return f; |
| 844 | #else |
| 845 | return fopen(path, mode); |
| 846 | #endif |
| 847 | } |
| 848 | |
| 849 | HB_DIR* hb_opendir(const char *path) |
| 850 | { |
no outgoing calls
no test coverage detected