
On Fri, 2014-02-21 at 02:37 +0100, Krzysztof KosiĆski wrote:
When I save this as /home/tweenk/src/junk/filetest.c, compile and run it in that directory, it prints "../junk/filetest.c exists". (This is on Ubuntu 13.10.) Are there problems with g_file_test on Windows?
Just tested with your example in /tmp
"/tmp/filetest.c" - Works as expected "/usr/../tmp/filetest.c" - Works as expected "/foo/filetest.c" - Fails as expected "/foo/../tmp/filetest.c" - Fails unexpectedly
It's checking the existence of every directory, even if it would be normalised out. That's a more subtle error than I first thought it was and probably not worth hassling over. I'll leave realpath out.
There's also a libxml variant xmlNormalizeURIPath "Applies the 5 normalization steps to a path string--that is, RFC 2396 Section 5.2, steps 6.c through 6.g. Normalization occurs directly on the string, no new allocation is done"
Martin,