X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=dirent_lose.c;fp=dirent_lose.c;h=716051b6ddbe2d7c51a3893048885cfb15a4f719;hp=0000000000000000000000000000000000000000;hb=977e372d5099e34ec88e59f3728c7944d97ed424;hpb=bdae4ca0d43c98d6b47c8b97d3190585a4ea206d diff --git a/dirent_lose.c b/dirent_lose.c new file mode 100644 index 0000000..716051b --- /dev/null +++ b/dirent_lose.c @@ -0,0 +1,35 @@ +#if defined(WIN32) || defined(WIN64) + +// Microsoft™ Windows™ dependent code + +// There is one, and only one case where this is needed and that's in a Visual +// Studio™ environment. Even building a Windows™ executable with MXE doesn't +// require this. So, even though this kind of thing is POSIX, it can't be +// included in a Visual Studio™ environment without adding a 3rd party shim. +// So we've made our own shim. +// +// The shim is minimal because the code in RMAC that uses it is minimal. If it +// gets expanded in the future for some reason, the shim will have to expand +// too. :-/ But that will never happen, right? ;-) +// + +#include "dirent_lose.h" + +#define WIN32_LEAN_AND_MEAN +#include + +static DIR dummy; + +DIR * opendir(const char * name) +{ + BOOL test = ((GetFileAttributesA(name) & FILE_ATTRIBUTE_DIRECTORY) != INVALID_FILE_ATTRIBUTES); + + return (test ? &dummy : NULL); +} + +int closedir(DIR * dir) +{ + return 0; +} + +#endif