# HG changeset patch # User Matti Hamalainen # Date 1352442055 -7200 # Node ID 4697c5bd70251c6044e4cf7edd6134c5297dab0c # Parent c835aa129e3b704768e71ed995ecdc379391fac7 Improve the path helper functions. diff -r c835aa129e3b -r 4697c5bd7025 src/xs_support.c --- a/src/xs_support.c Fri Nov 09 07:47:05 2012 +0200 +++ b/src/xs_support.c Fri Nov 09 08:20:55 2012 +0200 @@ -27,7 +27,11 @@ #include "xs_support.h" #include #include - +#ifndef __AUDACIOUS_NEWVFS__ +#include +#include +#include +#endif /* Error messages */ @@ -75,23 +79,28 @@ gboolean xs_is_dir_path(const gchar *path) { - XSFile *fp = xs_fopen(path, "rb"); - if (fp != NULL) - { - xs_fclose(fp); +#ifndef __AUDACIOUS_NEWVFS__ + struct stat sb; + if (stat(path, &sb) < 0) return FALSE; - } - else - return TRUE; + + return (S_ISDIR(sb.st_mode)); +#else + // XXX +#endif } gchar *xs_get_dir_path(const gchar *path) { - if (xs_is_dir_path(path)) +#ifndef __AUDACIOUS_NEWVFS__ + if (!xs_is_dir_path(path)) return g_dirname(path); else return g_strdup(path); +#else + // XXX +#endif }