aboutsummaryrefslogtreecommitdiffhomepage
path: root/options/path.c
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2015-09-11 23:01:12 +0200
committerGravatar wm4 <wm4@nowhere>2015-09-11 23:01:12 +0200
commitc2ee824c26ef152b5ed794f9b66ae7f3525dd008 (patch)
tree3726c6cdfd720f1842e41935ae4e1894bf6c9a13 /options/path.c
parentd96f6edf49ee345f189f8dc333fdbe25a60b3418 (diff)
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.
Diffstat (limited to 'options/path.c')
-rw-r--r--options/path.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/options/path.c b/options/path.c
index 29ebcd9277..c5c374690a 100644
--- a/options/path.c
+++ b/options/path.c
@@ -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) {