--log-file= doesn't support paths' expansion. #3591

Closed
gtm87x opened this Issue Sep 27, 2016 · 1 comment

Projects

None yet

1 participant

@gtm87x
gtm87x commented Sep 27, 2016

mpv version and platform

git master
OSX 10.12

Reproduction steps

I'm tring to debugging some issues with a couple of videos, so I tried to said the option in my config file to create a log file in my config directory every time I open a video via double click on it. But while other options understands '~/' correctly, --log-file= wants a full path or else it fails.

Expected behavior

The ~/ expands to the config directory.

Actual behavior

[global] Failed to open log file '~~/log.txt'

Log files

https://gist.github.com/gtm87x/0b446c3e067ca176393f313f3910de83

@wm4 wm4 added a commit that closed this issue Sep 28, 2016
@wm4 wm4 msg: make --log-file and --dump-stats accept config path expansion
Seems like a valid use-case. Not sure if I like it calling back into the
config code. Care has to be taken for not letting the config path
resolving code dead-lock (which is why locking details in the msg.c code
are changed).

Fixes #3591.
ef2bbd5
@wm4 wm4 closed this in ef2bbd5 Sep 28, 2016
@gtm87x
gtm87x commented Sep 28, 2016 edited

Thank you for the quick fix, it works!

P.S. As a side note, if the file exists beforehand, specifying log-file=~~/log.txt works as intended, if it doesn't exist the command fails with [global] Failed to open log file '~~/log.txt'. Specifying the full path works in both cases instead. I don't know if this is intended or not.

@wm4 wm4 added a commit that referenced this issue Sep 29, 2016
@wm4 wm4 path: default ~~ paths to home directory
The code for expanding the ~~ prefix used mp_find_config_file(), which
strictly looks for _existing_ files in any config path (e.g. not just
the user-local one, but also system-wide config). If no such file
exists, it simply returns NULL, which makes the code below just return
the literal, unexpanded path.

Change this so that it'll resolve the path to the user-local config
directory instead.

Requested in #3591.
86ab4b8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment