summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-11-01 07:19:58 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-11-01 07:19:58 -0700
commitaf26ff8c2bc0741eaca3a3f3c59ddd60227f38a3 (patch)
tree0307f36fa42b11d21b90f3ceabf733f2c26da418 /lib.c
parent5593e1e2bfd9e8026345a61b8735e3bb96084e89 (diff)
downloadtxr-af26ff8c2bc0741eaca3a3f3c59ddd60227f38a3.tar.gz
txr-af26ff8c2bc0741eaca3a3f3c59ddd60227f38a3.tar.bz2
txr-af26ff8c2bc0741eaca3a3f3c59ddd60227f38a3.zip
rel-path, path-equal: native Windows fixes.
The checks for native Windows are incorrect, plus there are some issues in the path-volume function. We cannot check for native Windows at macro-expansion time simply by calling (find #\\ path-sep-chars) because we compile on Cygwin where that is false. What we must do is check for being on Windows at macro-expansion time, and then in the "yes" branch of that decision, the code must perform the path-sep-char test at run-time. In the "no" branch, we can output smaller code that doesn't deal with Windows. * stdlib/copy-file.tl (if-windows, if-native-windows): New macro, which give a clear syntax to the above described testing. (path-split): Use if-native-windows. (path-volume): Use if-native-windows. In addition, fix some broken tests. The tests for a UNC path "//whatever" cannot just test that the first components are "", because that also matches the path "/". It has t be that the first two components are "", and there are more components. A similar issue occurs in the situation when there is a drive letter. We cannot conclude that if the component after the drive letter is "", then it's a drive absolute path, because that situation occurs in a path like "c:" which is relative. We also destructively manipulate the path to splice out the volume part and turn it into a simple relative or absolute path. This is because the path-simplify function deosn't deal with the volume prefix; its logic like eliminating .. navigations from root do not work if the prefix component is present. (rel-path): We handle a missing error case here: one path has volume prefix and the other doesn't. Also the error cases that can only occur on Windows are wrapped with if-windows to remove them at compile time.
Diffstat (limited to 'lib.c')
0 files changed, 0 insertions, 0 deletions