microsoft / microsoft/STL

std::filesystem::canonical converts the mapped network drive to network path

Open
#5,327 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

filesystem question
Dominant language
C++
Stars
11.1k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

or the below code:

std::error_code ec; auto long_path = std::filesystem::canonical("W:\\31\\arawat.fielsystem_default_check\\matlab\\check_std\\check_std\\").string();

I am getting the value of long path as:

"\\\\bgl-zp31-cifs\\vmgr\\sbs31\\arawat.fielsystem_default_check\\matlab\\check_std\\check_std"

std::filesystem::canonical is converting the path to a network path. Is there any way to prevent it or get the original drive letter path back from a network path.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the std::filesystem::canonical entry point and reproduce the mapped-drive example on Windows. Determine whether returning the UNC network path is required or unintended, then document the expected behavior or identify the relevant implementation change; no specific source file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.