mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-26 21:00:21 +00:00
options/path: fallback to USERPROFILE if HOME isn't set
HOME isn't set by default on Windows. But if the user does set it, prefer it by default. Enables stuff like --log-file=~/mpv.log to work, even if HOME isn't set.
This commit is contained in:
@@ -173,7 +173,10 @@ char *mp_get_user_path(void *talloc_ctx, struct mpv_global *global,
|
||||
talloc_free(tmp);
|
||||
}
|
||||
} else if (bstr_equals0(prefix, "")) {
|
||||
res = mp_path_join_bstr(talloc_ctx, bstr0(getenv("HOME")), rest);
|
||||
char *home = getenv("HOME");
|
||||
if (!home)
|
||||
home = getenv("USERPROFILE");
|
||||
res = mp_path_join_bstr(talloc_ctx, bstr0(home), rest);
|
||||
} else if (bstr_eatstart0(&prefix, "~")) {
|
||||
void *tmp = talloc_new(NULL);
|
||||
char type[80];
|
||||
|
||||
Reference in New Issue
Block a user