1 ! Copyright (C) 2008 Doug Coleman, Eduardo Cavazos.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors kernel system sequences combinators
4 vocabs vocabs.loader io.files.types io.directories math ;
8 TUPLE: file-info type size size-on-disk permissions created modified
11 HOOK: file-info os ( path -- info )
13 HOOK: link-info os ( path -- info )
15 : directory? ( file-info -- ? ) type>> +directory+ = ;
17 : sparse-file? ( file-info -- ? )
18 [ size-on-disk>> ] [ size>> ] bi < ;
21 HOOK: file-systems os ( -- array )
23 TUPLE: file-system-info device-name mount-point type
24 available-space free-space used-space total-space ;
26 HOOK: file-system-info os ( path -- file-system-info )
29 { [ os unix? ] [ "io.files.info.unix" ] }
30 { [ os windows? ] [ "io.files.info.windows" ] }
33 HOOK: copy-file-and-info os ( from to -- )
35 M: object copy-file-and-info copy-file ;