diff options
Diffstat (limited to 'src/main/path.c')
-rw-r--r-- | src/main/path.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/main/path.c b/src/main/path.c index 03ad06e..12a9ec8 100644 --- a/src/main/path.c +++ b/src/main/path.c @@ -1,5 +1,5 @@ /* - * "$Id: path.c,v 1.19 2006/07/07 21:31:02 rleigh Exp $" + * "$Id: path.c,v 1.20 2008/06/01 14:41:18 rlk Exp $" * * Gutenprint path functions - split and search paths. * @@ -33,8 +33,6 @@ #include <unistd.h> static int stpi_path_check(const struct dirent *module); -static char *stpi_path_merge(const char *path, - const char *file); static int stpi_scandir (const char *dir, struct dirent ***namelist, int (*sel) (const struct dirent *), @@ -150,11 +148,33 @@ stpi_path_check(const struct dirent *module) /* File to check */ return status; } +stp_list_t * +stpi_data_path(void) +{ + stp_list_t *dir_list; /* List of directories to scan */ + if (!(dir_list = stp_list_create())) + return NULL; + stp_list_set_freefunc(dir_list, stp_list_node_free_data); + if (getenv("STP_DATA_PATH")) + stp_path_split(dir_list, getenv("STP_DATA_PATH")); + else + stp_path_split(dir_list, PKGXMLDATADIR); + return dir_list; +} + +stp_list_t * +stpi_list_files_on_data_path(const char *name) +{ + stp_list_t *dir_list = stpi_data_path(); /* List of directories to scan */ + stp_list_t *file_list = stp_path_search(dir_list, name); + stp_list_destroy(dir_list); + return file_list; +} /* * Join a path and filename together. */ -static char * +char * stpi_path_merge(const char *path, /* Path */ const char *file) /* Filename */ { |