-#ifdef __UNIX__
-CppUnit::Test* GetlargeFileSuite() { return largeFile::suite(); }
-#else
-CppUnit::Test* GetlargeFileSuite() { return NULL; }
-#endif
+// return the suite if sparse files are supported, otherwise return NULL
+//
+CppUnit::Test* GetlargeFileSuite()
+{
+ wxString path;
+ struct stat st1, st2;
+ memset(&st1, 0, sizeof(st1));
+ memset(&st2, 0, sizeof(st2));
+
+ {
+ wxFile file;
+ path = wxFileName::CreateTempFileName(wxT("wxlfs-"), &file);
+
+ fstat(file.fd(), &st1);
+ file.Seek(st1.st_blksize);
+ file.Write("x", 1);
+ fstat(file.fd(), &st1);
+
+ file.Seek(0);
+ file.Write("x", 1);
+ fstat(file.fd(), &st2);
+ }
+
+ wxRemoveFile(path);
+
+ if (st1.st_blocks != st2.st_blocks)
+ return largeFile::suite();
+ else
+ return NULL;
+}