Suggested addition to the File Module: file:temp-dir and file:temp-file

The proposed EXProc File Utils steps[1] are pretty similar in functionality
to the EXPath File Module. However, I think the EXPath File Module is
missing one important thing; the ability to create temporary directories
(and files). I'd like to use XPath rather than XProc for this. So how about
something like:


file:temp-dir($prefix as xs:string, $suffix as xs:string) as xs:string
file:temp-dir($prefix as xs:string, $suffix as xs:string, $directory as
xs:string) as xs:string

Creates a temporary directory. The temporary directory is guaranteed not to
already exist when file:temp-dir is called.
If the directory argument is not given, then the directory will be created
inside the system-dependent default temporary-file directory.
The operation will create all non-existing parent directories.
The function returns the absolute URI of the temporary directory.


file:temp-file($prefix as xs:string, $suffix as xs:string) as xs:string
file:temp-file($prefix as xs:string, $suffix as xs:string, $directory as
xs:string) as xs:string

Creates a temporary file. The temporary file is guaranteed not to already
exist when file:temp-file is called.
If the directory argument is not given, then the file will be created
inside the system-dependent default temporary-file directory.
The operation will create all non-existing parent directories.
The function returns the absolute URI of the temporary file.


[1] http://exproc.org/proposed/steps/fileutils.html#tempfile

Jostein

Received on Wednesday, 23 January 2013 14:56:18 UTC