summaryrefslogtreecommitdiffstats
path: root/options/path.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-11-07 18:35:43 -0600
committerDudemanguy <random342@airmail.cc>2023-05-09 20:37:17 +0000
commit5158b85b21b9316b610ab59ba65da36144e03b9a (patch)
treeb5765fbb2910f7a54591923b974bc6a3575ce835 /options/path.c
parentbaa9d56481fe0f7633c77d0e7ee6ffd33b3a3783 (diff)
downloadmpv-5158b85b21b9316b610ab59ba65da36144e03b9a.tar.bz2
mpv-5158b85b21b9316b610ab59ba65da36144e03b9a.tar.xz
path: expand internal path selection API to allow for additional types
Currently, nothing new is actually implemented but the idea is simply to just pass a type string all the way up from mp_find_user_file down to actually getting the platform path. This allows for selecting different directories besides the user's native config directory. See the next commit for an implementation.
Diffstat (limited to 'options/path.c')
-rw-r--r--options/path.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/options/path.c b/options/path.c
index 4dfe36bd2d..bd8adf6d81 100644
--- a/options/path.c
+++ b/options/path.c
@@ -102,15 +102,15 @@ static const char *mp_get_platform_path(void *talloc_ctx,
return NULL;
}
-char *mp_find_user_config_file(void *talloc_ctx, struct mpv_global *global,
- const char *filename)
+char *mp_find_user_file(void *talloc_ctx, struct mpv_global *global,
+ const char *type, const char *filename)
{
void *tmp = talloc_new(NULL);
- char *res = (char *)mp_get_platform_path(tmp, global, config_dirs[0]);
+ char *res = (char *)mp_get_platform_path(tmp, global, type);
if (res)
res = mp_path_join(talloc_ctx, res, filename);
talloc_free(tmp);
- MP_DBG(global, "config path: '%s' -> '%s'\n", filename, res ? res : "-");
+ MP_DBG(global, "path: '%s' -> '%s'\n", filename, res ? res : "-");
return res;
}
@@ -378,9 +378,9 @@ void mp_mkdirp(const char *dir)
talloc_free(path);
}
-void mp_mk_config_dir(struct mpv_global *global, char *subdir)
+void mp_mk_user_dir(struct mpv_global *global, const char *type, char *subdir)
{
- char *dir = mp_find_user_config_file(NULL, global, subdir);
+ char *dir = mp_find_user_file(NULL, global, type, subdir);
if (dir)
mp_mkdirp(dir);
talloc_free(dir);