mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-26 21:00:21 +00:00
player: prefer logical current directory path
The "PWD" enviornment variable is described by POSIX. We don't go to length to verify its contents, but just trust it. This affects the logic for resuming playback.
This commit is contained in:
@@ -259,6 +259,10 @@ char *mp_path_join(void *talloc_ctx, const char *p1, const char *p2)
|
||||
|
||||
char *mp_getcwd(void *talloc_ctx)
|
||||
{
|
||||
char *e_wd = getenv("PWD");
|
||||
if (e_wd)
|
||||
return talloc_strdup(talloc_ctx, e_wd);
|
||||
|
||||
char *wd = talloc_array(talloc_ctx, char, 20);
|
||||
while (getcwd(wd, talloc_get_size(wd)) == NULL) {
|
||||
if (errno != ERANGE) {
|
||||
|
||||
Reference in New Issue
Block a user