Author: fperrad
Date: Wed Jan 24 01:50:04 2007
New Revision: 16775

Modified:
   trunk/src/pmc/os.pmc
   trunk/t/pmc/os.t

Log:
Make readdir method of OS PMC work on Windows/MinGW (more posix than M$VC).

Modified: trunk/src/pmc/os.pmc
==============================================================================
--- trunk/src/pmc/os.pmc        (original)
+++ trunk/src/pmc/os.pmc        Wed Jan 24 01:50:04 2007
@@ -19,12 +19,10 @@
 
 */
 
-#ifdef WIN32
-#  include <direct.h>

+#ifdef _MSC_VER
+#  include <direct.h>
 #  include <io.h>
-#endif
-
-#ifndef WIN32
+#else
 #  include <dirent.h>
 #endif
 
@@ -70,7 +68,7 @@
 
     METHOD STRING* cwd() {
         char * cwd;
-#ifdef WIN32
+#ifdef _MSC_VER
         cwd = _getcwd(NULL, 0);
 #else
 #  ifdef PATH_MAX
@@ -105,7 +103,7 @@
     METHOD void chdir(STRING *path) {
         int error;
         char *cpath = string_to_cstring(interp, path);
-#ifdef WIN32
+#ifdef _MSC_VER
         error = _chdir(cpath);
 #else
         error = chdir(cpath);
@@ -138,7 +136,7 @@
         }
 
         if (S_ISDIR(info.st_mode)) {
-#ifdef WIN32
+#ifdef _MSC_VER
             error = _rmdir(cpath);
 #else
             error = rmdir(cpath);
@@ -455,7 +453,7 @@
 
 */
     METHOD PMC* readdir(STRING* path) {
-#ifndef WIN32
+#ifndef _MSC_VER
         DIR *dir ;
         struct dirent *dirent;
         PMC *array;

Modified: trunk/t/pmc/os.t
==============================================================================
--- trunk/t/pmc/os.t    (original)
+++ trunk/t/pmc/os.t    Wed Jan 24 01:50:04 2007
@@ -13,6 +13,7 @@
 
 my $MSWin32 = $^O =~ m!MSWin32!;
 my $cygwin  = $^O =~ m!cygwin!;
+my $MSVC    = grep { $PConfig{cc} eq $_ } (qw(cl cl.exe));
 
 =head1 NAME
 
@@ -194,7 +195,7 @@
 
 # test readdir
 SKIP: {
-    skip 'not implemented on windows yet', 1 if ($MSWin32);
+    skip 'not implemented on windows yet', 1 if ($MSWin32 && $MSVC);
 
     opendir IN, '.';
     my @entries = readdir IN;

Reply via email to