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

Hi Jostein,

sounds like a good proposal, and I agree with both of Matthias’ revisions.

Another minor suggestion: I would like to update the file:size()
function to return 0 for directories instead of an exception.

Best,
Christian
___________________________

On Thu, Jan 24, 2013 at 12:04 AM, Matthias Brantner
<matthias.brantner@28msec.com> wrote:
> Jostein
>
> I think those functions are useful and I like the proposed changes.
>
> Would you mind changing the returned value to be a file path instead of the
> absolute URI?
> Otherwise, the return type should be xs:anyURI to be consistent with
> path-to-uri.
> Also, we should consider renaming the functions to create-temp-* because the
> functions
> actually create the files or directories, respectively.
>
> What do you think?
>
> Matthias
>
> On Jan 23, 2013, at 6:55 AM, Jostein Austvik Jacobsen <josteinaj@gmail.com>
> wrote:
>
> 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 23:21:51 UTC