Skip to content

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

@rikyoz

Description

@rikyoz

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

Metadata

Metadata

Assignees

Labels

WindowsWindows platform is affectedbugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions