src/mess/osd/sdl/winutils.c
| r0 | r2603 | |
| 1 | //============================================================ |
| 2 | // |
| 3 | // winutils.c - Generic Win32 utility code |
| 4 | // |
| 5 | //============================================================ |
| 6 | |
| 7 | // Needed for better file dialog |
| 8 | #ifdef _WIN32_WINNT |
| 9 | #undef _WIN32_WINNT |
| 10 | #endif // _WIN32_WINNT |
| 11 | #define _WIN32_WINNT 0x500 |
| 12 | |
| 13 | // standard windows headers |
| 14 | #define WIN32_LEAN_AND_MEAN |
| 15 | #include <windows.h> |
| 16 | #include <tchar.h> |
| 17 | |
| 18 | // MESS headers |
| 19 | #include "winutils.h" |
| 20 | #include "strconv.h" |
| 21 | #include "glob.h" |
| 22 | |
| 23 | //============================================================ |
| 24 | // win_get_file_attributes_utf8 |
| 25 | //============================================================ |
| 26 | |
| 27 | DWORD win_get_file_attributes_utf8(const char *filename) |
| 28 | { |
| 29 | DWORD result = ~0; |
| 30 | LPTSTR t_filename; |
| 31 | |
| 32 | t_filename = tstring_from_utf8(filename); |
| 33 | if (t_filename != NULL) |
| 34 | { |
| 35 | result = GetFileAttributes(t_filename); |
| 36 | free(t_filename); |
| 37 | } |
| 38 | return result; |
| 39 | } |
| 40 | |
| 41 | void win_expand_wildcards(int *argc, char **argv[]) |
| 42 | { |
| 43 | int i; |
| 44 | glob_t g; |
| 45 | |
| 46 | memset(&g, 0, sizeof(g)); |
| 47 | |
| 48 | for (i = 0; i < *argc; i++) |
| 49 | glob((*argv)[i], (g.gl_pathc > 0) ? GLOB_APPEND|GLOB_NOCHECK : GLOB_NOCHECK, NULL, &g); |
| 50 | |
| 51 | *argc = g.gl_pathc; |
| 52 | *argv = g.gl_pathv; |
| 53 | } |
src/mess/osd/sdl/winutils.h
| r0 | r2603 | |
| 1 | //============================================================ |
| 2 | // |
| 3 | // winutils.h - Generic Win32 utility code in MESS |
| 4 | // |
| 5 | //============================================================ |
| 6 | |
| 7 | #ifndef WINUTILS_H |
| 8 | #define WINUTILS_H |
| 9 | |
| 10 | #include <windows.h> |
| 11 | #include "osdcore.h" |
| 12 | |
| 13 | //============================================================ |
| 14 | // MISC |
| 15 | //============================================================ |
| 16 | |
| 17 | DWORD win_get_file_attributes_utf8(const char *filename); |
| 18 | |
| 19 | /* expand wildcards so '*' can be used */ |
| 20 | void win_expand_wildcards(int *argc, char **argv[]); |
| 21 | |
| 22 | #endif // WINUTILS_H |