file:descendants - returns relative paths
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ürgen
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, Christian
Written for BaseX 9.6. BaseX may have changed since: please check the current documentation.