file:descendants - returns relative paths
Friday, 11 February 2022 · 2 messages
HR
Hans-Juergen Rennau11 Feb 2022 14:49 #
Dear BaseX people,
functions
file:children() file:descendants()
should return the full paths of the resources found, but they do so only if the argument was in turn a full path. A bug? Example:
file:children('.')
=>PS C:\projects\xquery-introduction\tips> basex "file:children('.')" .\foo.xq
.\bar.docx
Kind regards,Hans-JürgenCG
Christian Grün11 Feb 2022 18:34 #
Hi Hans-Jürgen,
Quoted text · Hans-Juergen Rennau · 1 line
> should return the full paths of the resources found, but they do so only if the argument was in turn a full path. A bug?
The behavior is correct, but the wording in our documentation may be misleading: While
file:list will only return the paths after the input path, file:children and file:descendant will include the input path in the output. An example:
file:list('appraiser/')
appraiser.sdb
Appraiser_Data.ini
Appraiser_TelemetryRunList.xml
file:children('appraiser/')
appraiser\appraiser.sdb
appraiser\Appraiser_Data.ini
appraiser\Appraiser_TelemetryRunList.xml
You can retrieve the absolute path via file:path-to-native or file:resolve-path.
Hope this helps,
ChristianWritten for BaseX 9.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery