X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Ftests_filesystem%2Ftest_file_time.cpp;h=eae4c8d49b65f85d8bfe778de43d0fe0d41cc774;hb=cacdafd6f4a40d2d951bad5bb0f53142ed3fb7a6;hp=6e79f9a2b4fe10b5405259516996bce26e262d52;hpb=457b128b77b5b4a0b7dd3094de543de2ce1477ad;p=feisty_meow.git diff --git a/nucleus/library/tests_filesystem/test_file_time.cpp b/nucleus/library/tests_filesystem/test_file_time.cpp index 6e79f9a2..eae4c8d4 100644 --- a/nucleus/library/tests_filesystem/test_file_time.cpp +++ b/nucleus/library/tests_filesystem/test_file_time.cpp @@ -57,18 +57,26 @@ int test_file_time::execute() FUNCDEF("execute"); #ifdef __UNIX__ + // just open the root directory on unix; always works. astring toppy("/"); #endif #ifdef __WIN32__ - astring toppy("c:/ntldr"); // will work for any modern windows OS. + // windows cannot fopen a directory. this blows. so we pick a file + // that should work for most windowses. + astring toppy("c:/Windows/notepad.exe"); #endif // test storing info via the constructor. file_time absurdity_time(toppy); FILE *topdir = fopen(toppy.s(), "r"); + ASSERT_INEQUAL(topdir, NULL_POINTER, "opening topdir for testing"); + if (topdir == NULL_POINTER) { + return 1; + } file_time nutty_time(topdir); - struct stat sbuffer; + int filenum = fileno(topdir); + struct stat sbuffer; int stat_okay = fstat(filenum, &sbuffer); ASSERT_FALSE(stat_okay, "failure to read filetime"); file_time goofy_time(sbuffer.st_mtime);