diff options
Diffstat (limited to 'src/file-utils.c')
| -rw-r--r-- | src/file-utils.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/file-utils.c b/src/file-utils.c index 75bcb48..db06ff3 100644 --- a/src/file-utils.c +++ b/src/file-utils.c @@ -109,6 +109,14 @@ teco_file_set_attributes(const gchar *filename, teco_file_attributes_t attrs) #ifdef G_OS_UNIX +/* + * NOTE: This version does not resolve symlinks to non-existing paths. + * It could be improved by repeating readlink() and g_canonicalize_filename(), + * but it would require glib v2.58.0. + * Alternatively we could also iteratively resolve all path components. + * Currently, we simply do not rely on successful canonicalization of + * yet non-existing paths. + */ gchar * teco_file_get_absolute_path(const gchar *path) { @@ -137,13 +145,12 @@ teco_file_is_visible(const gchar *path) #if GLIB_CHECK_VERSION(2,58,0) /* - * FIXME: This should perhaps be preferred on any platform. - * But it will complicate preprocessing. + * NOTE: Does not resolve symlinks. */ gchar * teco_file_get_absolute_path(const gchar *path) { - return g_canonicalize_filename(path, NULL); + return path ? g_canonicalize_filename(path, NULL) : NULL; } #else /* !GLIB_CHECK_VERSION(2,58,0) */ |
