2007-08-28 11:20:24 +00:00
|
|
|
/*
|
|
|
|
* Get path to config dir/file.
|
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* This file is part of mpv.
|
2007-08-28 11:20:24 +00:00
|
|
|
*
|
2017-06-12 14:41:21 +00:00
|
|
|
* mpv is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2007-08-28 11:20:24 +00:00
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is distributed in the hope that it will be useful,
|
2007-08-28 11:20:24 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2017-06-12 14:41:21 +00:00
|
|
|
* GNU Lesser General Public License for more details.
|
2007-08-28 11:20:24 +00:00
|
|
|
*
|
2017-06-12 14:41:21 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
|
2007-08-28 11:20:24 +00:00
|
|
|
*/
|
|
|
|
|
2010-03-20 23:38:27 +00:00
|
|
|
#ifndef MPLAYER_PATH_H
|
|
|
|
#define MPLAYER_PATH_H
|
2007-08-28 11:20:24 +00:00
|
|
|
|
2012-02-03 07:05:11 +00:00
|
|
|
#include <stdbool.h>
|
2014-08-29 10:09:04 +00:00
|
|
|
#include "misc/bstr.h"
|
2024-02-19 09:11:25 +00:00
|
|
|
#include "misc/path_utils.h"
|
2011-02-23 14:18:09 +00:00
|
|
|
|
2013-12-21 19:45:19 +00:00
|
|
|
struct mpv_global;
|
2018-05-21 13:49:19 +00:00
|
|
|
struct MPOpts;
|
|
|
|
|
|
|
|
void mp_init_paths(struct mpv_global *global, struct MPOpts *opts);
|
2012-12-09 14:05:21 +00:00
|
|
|
|
|
|
|
// Search for the input filename in several paths. These include user and global
|
|
|
|
// config locations by default. Some platforms may implement additional platform
|
2024-02-20 20:24:54 +00:00
|
|
|
// related lookups (i.e.: macOS inside an application bundle).
|
2013-12-21 19:45:19 +00:00
|
|
|
char *mp_find_config_file(void *talloc_ctx, struct mpv_global *global,
|
|
|
|
const char *filename);
|
2012-12-09 14:05:21 +00:00
|
|
|
|
2022-11-08 00:35:43 +00:00
|
|
|
// Search for local writable user files within a specific kind of user dir
|
|
|
|
// as documented in osdep/path.h. This returns a result even if the file does
|
|
|
|
// not exist. Calling it with filename="" is equivalent to retrieving the path
|
|
|
|
// to the dir.
|
|
|
|
char *mp_find_user_file(void *talloc_ctx, struct mpv_global *global,
|
|
|
|
const char *type, const char *filename);
|
2015-05-09 14:21:44 +00:00
|
|
|
|
2014-06-18 23:55:40 +00:00
|
|
|
// Find all instances of the given config file. Paths are returned in order
|
2015-02-15 13:28:49 +00:00
|
|
|
// from lowest to highest priority. filename can contain multiple names
|
|
|
|
// separated with '|', with the first having highest priority.
|
2014-06-18 23:55:40 +00:00
|
|
|
char **mp_find_all_config_files(void *talloc_ctx, struct mpv_global *global,
|
|
|
|
const char *filename);
|
2011-02-23 14:18:09 +00:00
|
|
|
|
2013-12-14 18:50:00 +00:00
|
|
|
// 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.
|
2013-12-21 19:45:19 +00:00
|
|
|
char *mp_get_user_path(void *talloc_ctx, struct mpv_global *global,
|
|
|
|
const char *path);
|
2013-12-14 18:50:00 +00:00
|
|
|
|
2022-11-08 00:35:43 +00:00
|
|
|
void mp_mk_user_dir(struct mpv_global *global, const char *type, char *subdir);
|
2013-10-29 21:38:29 +00:00
|
|
|
|
2010-03-20 23:38:27 +00:00
|
|
|
#endif /* MPLAYER_PATH_H */
|