1 ! Copyright (C) 2012 Joe Groff.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: combinators init io.directories io.pathnames kernel
4 namespaces system vocabs vocabs.platforms ;
7 HOOK: default-temp-directory os ( -- path )
9 SYMBOL: current-temp-directory
11 : temp-directory ( -- path )
12 current-temp-directory get ;
14 : temp-file ( name -- path )
15 temp-directory prepend-path ;
17 : with-temp-directory ( quot -- )
18 [ temp-directory ] dip with-directory ; inline
20 HOOK: default-cache-directory os ( -- path )
22 SYMBOL: current-cache-directory
24 : cache-directory ( -- path )
25 current-cache-directory get ;
27 : cache-file ( name -- path )
28 cache-directory prepend-path ;
30 : with-cache-directory ( quot -- )
31 [ cache-directory ] dip with-directory ; inline
33 USE-MACOSX: io.files.temp.macosx
34 USE-UNIX: io.files.temp.unix
35 USE-WINDOWS: io.files.temp.windows
38 default-temp-directory dup make-directories
39 current-temp-directory set-global
41 default-cache-directory dup make-directories
42 current-cache-directory set-global