Dear BaseX people, I noticed a peculiar behaviour of file:current-dir() on a Windows system. file:current-dir()=>C:\program files\Oxygen XML Editor 25\ file:path-to-native(current-dir()=>C:\Program Files\Oxygen XML Editor 25\
Note the difference: "Program Files" vs. "programfiles". Is this intended? Would one not expect that any path returned by a file:* function *is* native? (Remark: the difference of case can become very important when constructing relative paths.) Kind regards,Hans-Jürgen : On the system in question, the folder "Program Files" is mapped to "programme" (I do not know the reasons. cu
Hi Hans-Jürgen,
Is this intended? Would one not expect that any path returned by a file:* function *is* native?
(Remark: the difference of case can become very important when constructing relative paths.)
The exact behavior of the file functions depend a lot on the operating system and local environment: As Windows ignores case, both "C:\a" and "C:\A" point to the same resource. It is only file:path-to-native (or Path.toRealPath, in Java) that retrieves the exact writing from the file system.
If we enforced all paths to be “native”, every function that references a nonexisting path would raise an error.
If you need a canonical path representation, however, and if you know that your files exist, it is best to always call file:path-to-native (it will also give you a good chance to think about the handling of symbolic links ;·).
Hope this helps, Christian ________________________________ Von: Hans-Juergen Rennau via BaseX-Talk basex-talk@mailman.uni-konstanz.de Gesendet: Freitag, 8. August 2025 11:40 An: BaseX basex-talk@mailman.uni-konstanz.de Betreff: [basex-talk] file:current-dir(), file:path-to-native()
Dear BaseX people,
I noticed a peculiar behaviour of file:current-dir() on a Windows system.
file:current-dir() => C:\program files\Oxygen XML Editor 25\
file:path-to-native(current-dir() => C:\Program Files\Oxygen XML Editor 25\
Note the difference: "Program Files" vs. "programfiles".
Is this intended? Would one not expect that any path returned by a file:* function *is* native? (Remark: the difference of case can become very important when constructing relative paths.)
Kind regards, Hans-Jürgen
: On the system in question, the folder "Program Files" is mapped to "programme" (I do not know the reasons.
cu
Great! Thank you, Christian, for the explanation and the advice. This is good to know, and I will do as you propose. Kind regards,Hans-Jürgen Am Freitag, 8. August 2025 um 11:52:51 MESZ hat Christian Grün cg@basex.org Folgendes geschrieben:
#yiv4623502021 P {margin-top:0;margin-bottom:0;}Hi Hans-Jürgen,
Is this intended? Would one not expect that any path returned by a file:* function *is* native? (Remark: the difference of case can become very important when constructing relative paths.)
The exact behavior of the file functions depend a lot on the operating system and local environment: As Windows ignores case, both "C:\a" and "C:\A" point to the same resource. It is only file:path-to-native (or Path.toRealPath, in Java) that retrieves the exact writing from the file system. If we enforced all paths to be “native”, every function that references a nonexisting path would raise an error. If you need a canonical path representation, however, and if you know that your files exist, it is best to always call file:path-to-native (it will also give you a good chance to think about the handling of symbolic links ;·). Hope this helps,ChristianVon: Hans-Juergen Rennau via BaseX-Talk basex-talk@mailman.uni-konstanz.de Gesendet: Freitag, 8. August 2025 11:40 An: BaseX basex-talk@mailman.uni-konstanz.de Betreff: [basex-talk] file:current-dir(), file:path-to-native() Dear BaseX people, I noticed a peculiar behaviour of file:current-dir() on a Windows system. file:current-dir()=>C:\program files\Oxygen XML Editor 25\ file:path-to-native(current-dir()=>C:\Program Files\Oxygen XML Editor 25\
Note the difference: "Program Files" vs. "programfiles". Is this intended? Would one not expect that any path returned by a file:* function *is* native? (Remark: the difference of case can become very important when constructing relative paths.) Kind regards,Hans-Jürgen : On the system in question, the folder "Program Files" is mapped to "programme" (I do not know the reasons. cu
basex-talk@mailman.uni-konstanz.de