blob: c43bb3dd9f68db9aea378ccb48ac013be0f291cf [file]
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
/* mingw-w64 headers */
#include "libtest.h"
void
test (char *path)
{
struct stat buf;
if (stat(path, &buf) == 0)
printf ("OK [%s]\n", path);
else {
printf ("ERROR [%s]: %d\n", path, errno);
abort();
}
}
void
wtest (wchar_t *path)
{
struct stat buf;
if (wstat(path, &buf) == 0)
wprintf (L"OK [%ls]\n", path);
else {
wprintf (L"ERROR [%ls]: %d\n", path, errno);
abort();
}
}
int
main (int argc, char **argv)
{
wchar_t windir_wbuf[MAX_PATH + 1];
char windir_abuf[MAX_PATH + 1];
mingw_test_init ();
if (GetWindowsDirectoryA(&windir_abuf[0], MAX_PATH))
{
strcat (&windir_abuf[0], "\\");
test (&windir_abuf[0]);
}
test ("c:\\");
test ("\\");
test ("/");
if (GetWindowsDirectoryW(&windir_wbuf[0], MAX_PATH))
{
wcscat (&windir_wbuf[0], L"\\");
wtest (windir_wbuf);
}
wtest (L"c:\\");
wtest (L"\\");
wtest (L"/");
return 0;
}