Author: ambs
Date: Tue Jan 10 13:34:26 2006
New Revision: 11063
Modified:
trunk/src/classes/os.pmc
trunk/t/pmc/os.t
Log:
os.pmc - call stat when lstat is called under windows.
os.t - correct stat test for windows
Modified: trunk/src/classes/os.pmc
==============================================================================
--- trunk/src/classes/os.pmc (original)
+++ trunk/src/classes/os.pmc Tue Jan 10 13:34:26 2006
@@ -264,12 +264,15 @@ Stats a file, and returns a 13 position
*/
METHOD PMC* lstat(STRING *path) {
-#ifndef WIN32
struct stat info;
PMC *array;
char *cpath = string_to_cstring(interpreter, path);
+#ifdef WIN32
+ int error = stat(cpath, &info);
+#else
int error = lstat(cpath, &info);
+#endif
string_cstring_free(cpath);
if (error) {
@@ -303,16 +306,14 @@ Stats a file, and returns a 13 position
info.st_mtime);
VTABLE_set_integer_keyed_int(interpreter, array,10,
info.st_ctime);
+#ifndef WIN32
VTABLE_set_integer_keyed_int(interpreter, array,11,
info.st_blksize);
VTABLE_set_integer_keyed_int(interpreter, array,12,
info.st_blocks);
+#endif
return array;
}
-#else
- internal_exception(UNIMPLEMENTED, "Win32 is not POSIX. Need win32
developer!");
- return NULL;
-#endif
}
/*
Modified: trunk/t/pmc/os.t
==============================================================================
--- trunk/t/pmc/os.t (original)
+++ trunk/t/pmc/os.t Tue Jan 10 13:34:26 2006
@@ -150,7 +150,7 @@ my $stat;
if ($cygwin || $MSWin32) {
# Skip inode number
my @s = stat('xpto');
- $stat = join("\n",$s[0],@s[2..12])."\n";
+ $stat = join("\n",$s[0],@s[2..10])."\n";
pir_output_is(<<'CODE', $stat, "Test OS.stat");
.sub main :main
$P1 = new .OS
@@ -164,7 +164,7 @@ loop:
print "\n"
$I1 += 1
if $I1 == 1 goto inc
- if $I1 == 13 goto done
+ if $I1 == 11 goto done
goto loop
inc:
$I1 += 1