* fix mu_util_dir_expand for non-existant dirs, add unit test

This commit is contained in:
Dirk-Jan C. Binnema
2010-12-04 19:14:31 +02:00
parent 6a3decdc7c
commit 0b87be5f18
2 changed files with 23 additions and 1 deletions

View File

@ -93,7 +93,11 @@ mu_util_dir_expand (const char *path)
dir = do_wordexp (path);
if (!dir)
return NULL; /* error */
/* don't try realpath if the dir does not exist */
if (access (dir, F_OK) != 0)
return dir;
/* now resolve any symlinks, .. etc. */
if (realpath (dir, resolved) == NULL) {
g_debug ("%s: could not get realpath for '%s': %s",