Hi, Graydon, you ask what I mean by "Providing the parameter value to file:children as a relative path".
With "the parameter value" I mean the value passed to file:children() or file:descendants(), and it's clear what is meant by a relative path (a path not starting at the foot of the file system). For this reason, your statement:"file:resolve-path('../xslt',file:base-dir()) => file:children() works. That's what I'd think of as providing a relative path."confuses me, because you do provide an absolute path, as the argument is an invocation of file:resolve-path(). As you bring function file:base-dir() into play, let me point out one remarkable fact: whereas all (?) functions of the file module resolve relative paths against the current working directory, this function does not return the current working directory (for that we have file:current-dir()), but the "parent directory of the static base URI", in other words: the directory containing the XQuery module containing the code. Therefore note that if file:descendants('../xslt') yields an error, it means that the current working directory does not have a sibling xslt directory - not that the directory containing the XQuery module does not have that sibling. Finally, let me summarize my point: (1) The functions file:children() and file:descendants() take a single parameter which is a path which may be specified as absolute path or relative path to be resolved against the current working directory. (2) Irrespectived of how the argument was supplied, the functions must always return absolute paths.(3) If you want a file listing to return relative paths, use function file:list(). Kind regards,Hans-Jürgen Am Samstag, 24. September 2022 um 21:03:18 MESZ hat Graydon graydonish@gmail.com Folgendes geschrieben:
On Sat, Sep 24, 2022 at 06:22:41PM +0000, Hans-Juergen Rennau scripsit:
Maybe this is a misunderstanding, Graydon: the ability to use relative paths *as parameter value*, and to have it automatically resolved against the current working directory, is certainly essential. But the *result* should be independent of whether the parameter was supplied as relative or absolute path. It is simply a bug.Use the file:list() function if you want to get relative paths.
It's entirely possible I'm miscomprehending something.
In the 10.1 GUI, file:base-dir() gives a result. Per https://docs.basex.org/wiki/File_Module#file:list that result is the current working directory. It looks like that value is the last directory I saved a file in from the GUI.
concat(file:base-dir(),'../xslt') => file:descendants() works. But of course that's an absolute path.
file:resolve-path('../xslt',file:base-dir()) => file:children() works. That's what I'd think of as providing a relative path.
file:descendants('../xslt') does not work: 'Resource "../xslt" not found' is no directory.
I wouldn't expect it to work, but that might be an error of expectation rather than properly reflecting what should happen.
I think I'm misunderstanding what you mean by providing the parameter value to file:children or file:descendant as a relative path. Could you provide an example of the bug?
-- Graydon