pathman icon indicating copy to clipboard operation
pathman copied to clipboard

bug: Pathman uses forward slash instead of backslash

Open chipbite opened this issue 7 months ago • 2 comments

Describe the bug

Running sample command (%userprofile%\bin\pathman.exe add ~/bin) path entry is added...

Expected: with backslash. ( C:\Users\mawid6\bin; )

Actual: with forward slash. ( C:\Users\mawid6/bin; )

E g:

C:\Users\mawid6>reg query "HKCU\Environment"

HKEY_CURRENT_USER\Environment
    Path    REG_SZ    C:\Users\mawid6/bin;C:\Users\mawid6\AppData\Local\Programs\Python\Python313\Scripts\;C:\Users\mawid6\AppData\Local\Programs\Python\Python313\;C:\Users\mawid6\AppData\Local\Programs\Python\Launcher\;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Users\mawid6\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\mawid6\AppData\Local\Microsoft\WinGet\Links;C:\Users\mawid6\AppData\Roaming\npm;%USERPROFILE%\go\bin

To Reproduce

Win 11, cmd.exe, run sample command as detailed above.

Device / Machine (please complete):

  • OS/Device: Win 11, Microsoft Windows [Version 10.0.26100.3775]

Image

  • Arch: x64 (installed amd64 version, e g https://git.rootprojects.org/root/pathman/releases/download/v0.5.2/pathman-v0.5.2-windows-amd64.zip).
  • Version 0.5.2.

Additional context

Little/no impact, just looks bad.

chipbite avatar May 20 '25 13:05 chipbite

It just seems to use the path separator that is given as input. So, if I try with this instead: C:\Users\mawid6>%userprofile%\bin\pathman.exe add ~\bin

It uses a backslash.

chipbite avatar May 20 '25 13:05 chipbite

Yeah... Windows accepts both forward and backwards slashes and at the time that I wrote this, I was hoping to be able to document its usage in the POSIX-style regardless of the platform.

However, some of the PATH-normalization logic is incorrect.

coolaj86 avatar May 21 '25 06:05 coolaj86