codereport / jsource

J Language Source Code. Livestream links ⬇️
https://www.youtube.com/playlist?list=PLVFrD1dmDdvfVhYLU_iKkV67X9XqCJLWe
Other
38 stars 20 forks source link

Fix handling of `..` in `jepath()` (requires <filesystem> header) #170

Open juntuu opened 3 years ago

juntuu commented 3 years ago

Resolves #169

Oh, <filesystem> header is not available...

I'll leave this here for now, until the future of possibly supporting compiler is cleared

After this fix ../ path components are correctly backed off.

The backing off is done lexically, as was before in the C version, so traversing through symlink and then back (to the parent of the symlinked directory) with ".." still fails.

herwinw commented 3 years ago

The Ci uses G++ 7.5, which is kind of ancient. From the top of my head, you need version 8 to get full support for C++-17, which introduced the filesystem header. C++-20 is only supported since version 10 (although I'm not sure if it's fully supported yet).

We could work around this problem with a bunch of regexes and dealing with a lot of corner cases, but I'm pretty sure we're going to run into similar problems again when we try to convert code to C++-20. So I guess we're up for another 5 hour episode of getting a CI to run ;)

juntuu commented 3 years ago

We could work around this problem with a bunch of regexes and dealing with a lot of corner cases,

I think in this case it's better to just wait, as c++20 will anyways be the eventual target. Also the issue is not too bad to work with.