io.files.temp: adding with-temp-directory and with-cache-directory.
parent
fd2803a916
commit
a20f12005a
|
@ -4,14 +4,15 @@ IN: io.files.temp
|
|||
ARTICLE: "io.files.temp" "Temporary files"
|
||||
"Pathnames relative to the system's temporary file directory:"
|
||||
{ $subsections
|
||||
temp-directory
|
||||
temp-file
|
||||
temp-directory
|
||||
with-temp-directory
|
||||
}
|
||||
"Pathnames relative to Factor's cache directory, used to store persistent intermediate files and resources:"
|
||||
{ $subsections
|
||||
cache-directory
|
||||
cache-file
|
||||
cache-directory
|
||||
with-cache-directory
|
||||
} ;
|
||||
|
||||
|
||||
ABOUT: "io.files.temp"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
! (c)2012 Joe Groff bsd license
|
||||
USING: combinators io.pathnames kernel system vocabs ;
|
||||
USING: combinators io.directories io.pathnames kernel system
|
||||
vocabs ;
|
||||
IN: io.files.temp
|
||||
|
||||
HOOK: temp-directory os ( -- path )
|
||||
|
@ -8,9 +9,15 @@ HOOK: cache-directory os ( -- path )
|
|||
: temp-file ( name -- path )
|
||||
temp-directory prepend-path ;
|
||||
|
||||
: with-temp-directory ( quot -- )
|
||||
[ temp-directory ] dip with-directory ; inline
|
||||
|
||||
: cache-file ( name -- path )
|
||||
cache-directory prepend-path ;
|
||||
|
||||
: with-cache-directory ( quot -- )
|
||||
[ cache-directory ] dip with-directory ; inline
|
||||
|
||||
{
|
||||
{ [ os windows? ] [ "io.files.temp.windows" ] }
|
||||
{ [ os macosx? ] [ "io.files.temp.macosx" ] }
|
||||
|
|
Loading…
Reference in New Issue