]> Shamusworld >> Repos - rmac/blob - dirent_lose.c
Version bump for last commit. :-)
[rmac] / dirent_lose.c
1 #if defined(WIN32) || defined(WIN64)
2
3 // Microsoft™ Windows™ dependent code
4
5 // There is one, and only one case where this is needed and that's in a Visual
6 // Studio™ environment.  Even building a Windows™ executable with MXE doesn't
7 // require this.  So, even though this kind of thing is POSIX, it can't be
8 // included in a Visual Studio™ environment without adding a 3rd party shim.
9 // So we've made our own shim.
10 //
11 // The shim is minimal because the code in RMAC that uses it is minimal.  If it
12 // gets expanded in the future for some reason, the shim will have to expand
13 // too.  :-/  But that will never happen, right?  ;-)
14 //
15
16 #include "dirent_lose.h"
17
18 #define WIN32_LEAN_AND_MEAN
19 #include <windows.h>
20
21 static DIR dummy;
22
23 DIR * opendir(const char * name)
24 {
25         BOOL test = ((GetFileAttributesA(name) & FILE_ATTRIBUTE_DIRECTORY) != INVALID_FILE_ATTRIBUTES);
26
27         return (test ? &dummy : NULL);
28 }
29
30 int closedir(DIR * dir)
31 {
32         return 0;
33 }
34
35 #endif