-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use proper slash seperator for windows file paths #6565
Comments
No, it outputs exactly the value you used when running mpv . If you want paths to contain only edit: mpv does seem to use |
Can you point me to some documentation to how I can hook into mpv with a script to do that? I really don't understand much of anything about how input.conf works or what it is, and explorer doesn't seem to like the way mpv spits out the path by default... |
The manual has sections about scripting in lua/js. This should work also for directory playlist items: save this text as
Then in your
|
Ty, this works exactly as I needed. I had no idea that mpv could be extended like this. I will keep this in mind going forward. Still might want to consider changing how mpv appends slashes to paths in windows, but this is good enough for me. Ty again. 😄 |
See #6570 |
This is done by converting `/` to `\` when the joined path is a windows absolute file path, otherwise `/` is kept. Fixes mpv-player#6565.
since the PR was closed this idea is off the table. |
You can also do this entirely from within
Note that this example is using the custom quote syntax with the backtick ` character. Edit: updated to use two backticks instead of `! |
I use forward slashes only for my personal usage, in my public user scripts and mpv.net I don't generate forward and double slashes to ensure the highest possible compatibility with other user scripts. In mpv.net, I normalize paths in some locations to ensure compatibility with some user scripts that generate forward slashes, such as mpv-file-browser @CogentRedTester, and also mpv generating a playlist from a directory. There are other opinions, that's how I do it. |
Powershell is a bit slow, in most use cases fast enough, to be exact the startup is 200 ms when it was started before, for pwsh it's 400 ms. I try your solution and use it if it works. |
Oh yea it's very slow compared to cmd or bash, but if you're just trying to open |
I confirm that it works perfectly, and the delay is no problem for this use case. |
I'm not understanding the exclamation marks in the command line, what do I have to google to find the documentation for it? |
flat-command-syntax, the 5th paragraph on custom quotes. I should probably change the example to use two backticks instead of `! though, I didn't know that two backticks were valid. |
Thanks! |
mpv version and platform
Windows 10
Reproduction steps
Add
ctrl+e run explorer /select, ${path}
to input.conf in windows 10
Expected behavior
On Windows use '\' only as the separator when printing paths so that it can be passed to file explorer to open the explorer with the file selected properly.
Actual behavior
mpv outputs the path using '/'s instead for sub-directories which apparently confuses windows' file explorer.
Alternate reproduction method
This behaviour can be very clearly observed why playing a folder of files in windows with a command such as:
mpv.exe "<path to music folder>/Music videos folder" --shuffle
and adding
ctrl+e show-text ${path}
to input.conf
Then just press ctrl+e and observe the mixed
\
and/
This was discussed more in this thread if it is unclear: #6560
The text was updated successfully, but these errors were encountered: