file-system-info ( path -- file-system-info )
Factor documentation > Factor handbook > Input and output > File system meta-data
Prev:File types
Next:file-systems ( -- array )


Vocabulary
io.files.info

Inputs and outputs
patha pathname string
file-system-infoa file-system-info


Word description
Returns a platform-specific object describing the file-system that contains the path. The cross-platform slot is free-space.

Examples
USING: io.files.info io.pathnames math prettyprint ; IN: scratchpad : gb ( m -- n ) 30 2^ * ; home file-system-info free-space>> 100 gb < .
f


Definition
IN: io.files.info

TUPLE: file-system-info
device-name mount-point type available-space free-space
used-space total-space ;


USING: system ;

IN: io.files.info

HOOK: file-system-info os ( path -- file-system-info )


Methods
USING: accessors combinators io.backend io.files.info
io.files.info.unix io.files.info.unix.linux kernel system ;

M: linux file-system-info
normalize-path [
[ new-file-system-info ] dip
[ file-system-statfs statfs>file-system-info ]
[ file-system-statvfs statvfs>file-system-info ] bi
file-system-calculations
] keep find-mount-point {
[ file-system-name>> >>device-name drop ]
[ mount-point>> >>mount-point drop ]
[ type>> >>type ]
} 2cleave ;


USING: io.backend io.files.info io.files.info.unix kernel
system ;

M: unix file-system-info
normalize-path [ new-file-system-info ] dip
[ file-system-statfs statfs>file-system-info ]
[ file-system-statvfs statvfs>file-system-info ] bi
file-system-calculations ;