GNOME Bugzilla – Bug 394577
Add a function to resolve symlinks
Last modified: 2012-12-18 17:02:10 UTC
A mix of canonicalize_filename() (as existing in gtkfilesystemunix.c), and a g_file_read_link() loop.
On glibc systems, one can use "realpath()" with the second argument being NULL, but it will crash on systems with non-GNU libcs. See bug 394505 for the original report. We could call it g_file_resolve_link ()
*** Bug 558445 has been marked as a duplicate of this bug. ***
gio provides g_file_resolve_relative_path
g_file_resolve_relative_path() isn't quite it, as you still need to use g_file_read_link() to read the link destination. g_file_resolve_link() would read where the link points to, resolve it, check whether it is a link, etc. taking care of link loops as well.
Did you have a look at bug 111848? The proposed function has an option to resolve symbolic links.
It does indeed, and would fix the problem for me. *** This bug has been marked as a duplicate of bug 111848 ***