More fixes

db4
Slava Pestov 2008-03-13 22:08:57 -05:00
parent a65c96042d
commit 1289cfa8e3
3 changed files with 19 additions and 20 deletions

View File

@ -5,6 +5,6 @@ IN: io.mmap.tests
[ "mmap-test-file.txt" resource-path delete-file ] ignore-errors
[ ] [ "12345" "mmap-test-file.txt" resource-path ascii set-file-contents ] unit-test
[ ] [ "mmap-test-file.txt" resource-path dup file-info file-info-length [ CHAR: 2 0 pick set-nth drop ] with-mapped-file ] unit-test
[ 5 ] [ "mmap-test-file.txt" resource-path dup file-info file-info-length [ length ] with-mapped-file ] unit-test
[ 5 ] [ "mmap-test-file.txt" resource-path dup file-info file-info-size [ length ] with-mapped-file ] unit-test
[ "22345" ] [ "mmap-test-file.txt" resource-path ascii file-contents ] unit-test
[ "mmap-test-file.txt" resource-path delete-file ] ignore-errors

View File

@ -1,15 +1,15 @@
! Copyright (C) 2005, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: io.backend io.nonblocking io.unix.backend io.files io
unix unix.stat unix.time kernel math continuations math.bitfields
byte-arrays alien combinators combinators.cleave calendar
io.encodings.binary ;
unix unix.stat unix.time kernel math continuations
math.bitfields byte-arrays alien combinators combinators.cleave
calendar io.encodings.binary ;
IN: io.unix.files
M: unix-io cwd
MAXPATHLEN dup <byte-array> swap
getcwd [ (io-error) ] unless* ;
MAXPATHLEN [ <byte-array> ] [ ] bi getcwd
[ (io-error) ] unless* ;
M: unix-io cd
chdir io-error ;
@ -68,7 +68,9 @@ M: unix-io delete-directory ( path -- )
] with-disposal ;
M: unix-io copy-file ( from to -- )
[ (copy-file) ] 2keep swap file-info file-info-permissions io-error ;
[ (copy-file) ]
[ swap file-info file-info-permissions chmod io-error ]
2bi ;
: stat>type ( stat -- type )
stat-st_mode {
@ -82,8 +84,8 @@ M: unix-io copy-file ( from to -- )
{ [ t ] [ +unknown+ ] }
} cond nip ;
M: unix-io file-info ( path -- info )
stat* {
: stat>file-info ( stat -- info )
{
[ stat>type ]
[ stat-st_size ]
[ stat-st_mode ]
@ -91,11 +93,8 @@ M: unix-io file-info ( path -- info )
} cleave
\ file-info construct-boa ;
M: unix-io file-info ( path -- info )
stat* stat>file-info ;
M: unix-io link-info ( path -- info )
lstat* {
[ stat>type ]
[ stat-st_size ]
[ stat-st_mode ]
[ stat-st_mtim timespec-sec seconds unix-1970 time+ ]
} cleave
\ file-info construct-boa ;
lstat* stat>file-info ;

View File

@ -12,25 +12,25 @@ tools.deploy.backend math sequences io.launcher ;
[ ] [ "hello-world" shake-and-bake ] unit-test
[ t ] [
"hello.image" temp-file file-info file-info-length 500000 <=
"hello.image" temp-file file-info file-info-size 500000 <=
] unit-test
[ ] [ "sudoku" shake-and-bake ] unit-test
[ t ] [
"hello.image" temp-file file-info file-info-length 1500000 <=
"hello.image" temp-file file-info file-info-size 1500000 <=
] unit-test
[ ] [ "hello-ui" shake-and-bake ] unit-test
[ t ] [
"hello.image" temp-file file-info file-info-length 2000000 <=
"hello.image" temp-file file-info file-info-size 2000000 <=
] unit-test
[ ] [ "bunny" shake-and-bake ] unit-test
[ t ] [
"hello.image" temp-file file-info file-info-length 3000000 <=
"hello.image" temp-file file-info file-info-size 3000000 <=
] unit-test
[ ] [