Skip to content
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

Wrong result when appending to UNC paths with only the host name #191

Open
rikyoz opened this issue Jan 23, 2025 · 0 comments
Open

Wrong result when appending to UNC paths with only the host name #191

rikyoz opened this issue Jan 23, 2025 · 0 comments
Assignees
Labels
bug Something isn't working Windows Windows platform is affected

Comments

@rikyoz
Copy link
Contributor

rikyoz commented Jan 23, 2025

Describe the bug

Appending to an UNC path with only the host name (e.g., \\server) doesn't append the preferred separator before the appended path.
If the UNC path contains share names (e.g., \\server\share), appending works fine.

To Reproduce

Code:

namespace fs = std::filesystem;
namespace gfs = ghc::filesystem;

std::cout << (fs::path{"\\\\server"} / "abc") << " vs " << (gfs::path{"\\\\server"} / "abc") << std::endl;

Output:

"\\\\server\\abc" vs "\\\\serverabc"

Expected behavior

When appending to the path, the preferred path separator should also be appended before the appended path (in the example, \\\\server\\abc).

Additional context

Godbolt

@rikyoz rikyoz changed the title Wrong append to UNC paths with only the host name Wrong result when appending to UNC paths with only the host name Jan 23, 2025
@gulrak gulrak added bug Something isn't working Windows Windows platform is affected labels Jan 24, 2025
@gulrak gulrak self-assigned this Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Windows Windows platform is affected
Projects
None yet
Development

No branches or pull requests

2 participants