File module path encodings

Wednesday, 3 April 2013 · 3 messages · last reply 12 Apr 2013
AB
Andy Bunce3 Apr 2013 16:20 #
Hi, The following two expressions create a file called "d d.txt" (Windows, BaseX 7.6)
  file:write("c:\temp\d d.txt","what")
 file:write("c:\temp\d%20d.txt","what")
I wonder if it would not be better if the second would create a file "d%20d.txt"? My use case is creating a file name that encodes a path e.g. "lib%5Cfile.txt". The currently gives an error, as it is looking for a folder lib. I read http://expath.org/spec/file#d3e112 as meaning url encoded file names must start file:/// and if no file:/// the name should be used as is. /Andy
FG
Florent Georges3 Apr 2013 16:57 #
Quoted text · Andy Bunce · 1 line
Andy Bunce wrote:
Hi,
Quoted text · Andy Bunce · 3 lines
> I read http://expath.org/spec/file#d3e112 as meaning url > encoded file names must start file:/// and if no file:/// the > name should be used as is.
Yes, that's what I understand as well. And that's why I think it would be probably a good idea to deal only with URIs on the one hand (for parameters of the File Module functions, like file:write()), and use another couple of functions to explicitly convert between native paths and URIs when needed (like in the section http://expath.org/spec/file#d3e1404). Regards,
CG
Christian Grünin reply to Andy Bunce, 3 Apr 2013, 16:2012 Apr 2013 13:25 #
Hi Andy, I agree with you. The latest snapshot now does what it is supposed to do. Thanks, Christian
Quoted text · Andy Bunce · 27 lines
On Wed, Apr 3, 2013 at 4:20 PM, Andy Bunce <bunce.andy at gmail.com> wrote: > Hi, > The following two expressions create a file called "d d.txt" (Windows, BaseX > 7.6) > > file:write("c:\temp\d d.txt","what") > file:write("c:\temp\d%20d.txt","what") > > I wonder if it would not be better if the second would create a file > "d%20d.txt"? > > My use case is creating a file name that encodes a path e.g. > "lib%5Cfile.txt". The currently gives an error, as it is looking for a > folder lib. > > I read http://expath.org/spec/file#d3e112 as meaning url encoded file names > must start file:/// and if no file:/// the name should be used as is. > > /Andy > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >

⚡Generated with XQuery