From 1289cfa8e3f6d7bf49b016844954d6756448c1cc Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 13 Mar 2008 22:08:57 -0500 Subject: [PATCH] More fixes --- extra/io/mmap/mmap-tests.factor | 2 +- extra/io/unix/files/files.factor | 29 +++++++++++++------------- extra/tools/deploy/deploy-tests.factor | 8 +++---- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/extra/io/mmap/mmap-tests.factor b/extra/io/mmap/mmap-tests.factor index be5dc48bf0..c75c7b9bd4 100755 --- a/extra/io/mmap/mmap-tests.factor +++ b/extra/io/mmap/mmap-tests.factor @@ -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 diff --git a/extra/io/unix/files/files.factor b/extra/io/unix/files/files.factor index bdcd0b985d..1e7d682314 100755 --- a/extra/io/unix/files/files.factor +++ b/extra/io/unix/files/files.factor @@ -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 swap - getcwd [ (io-error) ] unless* ; + MAXPATHLEN [ ] [ ] 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 ; diff --git a/extra/tools/deploy/deploy-tests.factor b/extra/tools/deploy/deploy-tests.factor index 408d3d0afb..a6e126ea9e 100755 --- a/extra/tools/deploy/deploy-tests.factor +++ b/extra/tools/deploy/deploy-tests.factor @@ -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 [ ] [