a bunch of cleaning to get wayward unit tests passing on windows. not there yet.
[feisty_meow.git] / nucleus / library / tests_filesystem / test_file_time.cpp
index 6e79f9a2b4fe10b5405259516996bce26e262d52..14e25490ffdd5deabc54ae91d3a779ba4fe26894 100644 (file)
@@ -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, NIL, "opening topdir for testing");
+  if (topdir == NIL) {
+    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);