Solved: Clap (derive): How do I receive multiple Windows paths and properly handle the backslashes?

I have written a personal CLI tool to manage audiobook metadata. I need to accept multiple paths (incl. wildcard globs).

It works perfectly fine on Mac and Linux. But on Windows it interprets the backslashes in the paths as escape characters.
I have experimented with Vec and Vec as the Clap argument type, but neither seem to work.

Any ideas?

Okay, the relevant information here is that you're writing them to a file in order to use FFmpeg's concat demuxer like this section shows. FFmpeg is the one interpreting the backslashes as escape characters. You can either replace them with forward slashes / or double them \\ when you write them to the file.

2 Likes

Solved: It turned out that it did work when i switched back to Vec.