Skip to content

Windows: path with trailing backslash causes "does not exist" error #187

Description

@joffrey-b

Description

When passing a path that contains spaces on Windows, the shell requires quoting. Tab-completion in PowerShell automatically appends a trailing backslash to directory paths, producing a form like:

rsgain easy "C:\Users\Joffrey\Music\A Feast For Kings\"

This triggers a Windows argument parsing quirk: CommandLineToArgvW treats \" as a literal " rather than the closing delimiter of the quoted argument. As a result, argv receives the path with a trailing " instead of \:

[FAILURE] Directory 'C:\Users\Joffrey\Music\A Feast For Kings"' does not exist

The same issue occurs with single quotes in PowerShell, since PowerShell still builds the same underlying Windows process command line.

Steps to reproduce

  1. Have a directory with a space in its name
  2. Run rsgain easy "C:\path\to\My Folder\" (trailing backslash before closing quote)

Expected: rsgain processes the directory
Actual: [FAILURE] Directory '...' does not exist with a stray " at the end of the path

Affects both easy mode (directory argument) and custom mode (file path arguments).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions