From ad2199128da4a689be374e92aab57ac2c9fa76b9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 21 Dec 2013 20:45:19 +0100 Subject: path lookup functions: mp_msg conversions There's a single mp_msg() in path.c, but all path lookup functions seem to depend on it, so we get a rat-tail of stuff we have to change. This is probably a good thing though, because we can have the path lookup functions also access options, so we could allow overriding the default config path, or ignore the MPV_HOME environment variable, and such things. Also take the chance to consistently add talloc_ctx parameters to the path lookup functions. Also, this change causes a big mess on configfiles.c. It's the same issue: everything suddenly needs a (different) context argument. Make it less wild by providing a mp_load_auto_profiles() function, which isolates most of it to configfiles.c. --- options/path.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'options/path.h') diff --git a/options/path.h b/options/path.h index e3de212ef3..0e1744bbd0 100644 --- a/options/path.h +++ b/options/path.h @@ -24,22 +24,27 @@ #include #include "bstr/bstr.h" +struct mpv_global; // Search for the input filename in several paths. These include user and global // config locations by default. Some platforms may implement additional platform // related lookups (i.e.: OSX inside an application bundle). -char *mp_find_config_file(const char *filename); +char *mp_find_config_file(void *talloc_ctx, struct mpv_global *global, + const char *filename); // Search for the input filename in the global configuration location. -char *mp_find_global_config_file(const char *filename); +char *mp_find_global_config_file(void *talloc_ctx, struct mpv_global *global, + const char *filename); // Search for the input filename in the user configuration location. -char *mp_find_user_config_file(const char *filename); +char *mp_find_user_config_file(void *talloc_ctx, struct mpv_global *global, + const char *filename); // Normally returns a talloc_strdup'ed copy of the path, except for special // paths starting with '~'. Used to allow the user explicitly reference a // file from the user's home or mpv config directory. -char *mp_get_user_path(void *talloc_ctx, const char *path); +char *mp_get_user_path(void *talloc_ctx, struct mpv_global *global, + const char *path); // Return pointer to filename part of path @@ -70,6 +75,6 @@ bool mp_path_isdir(const char *path); bool mp_is_url(bstr path); -void mp_mk_config_dir(char *subdir); +void mp_mk_config_dir(struct mpv_global *global, char *subdir); #endif /* MPLAYER_PATH_H */ -- cgit v1.2.3