getDirectorySeparator() returns "\\" on Windows but it sometimes should return "/"

Open
#246 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
testing-qa

Research direction

Start in SystemUtils.cpp by reading getDirectorySeparator() and the surrounding path-handling code. Reproduce the directory-creation failure in WSL or Windows WorkSpaces Applications, then run the affected tests to verify that paths use the appropriate separator and directory creation succeeds.

Written by the indexing model from the issue text.

Description

In SystemUtils.cpp there is a function "getDirectorySeparator()". On Windows (when #ifdef _WIN32 returns true) it returns "\".

When you are running under WSL it needs to return "/".
When you are running on a Windows machine under AWS "WorkSpaces Applications" it also needs to return "/".

If you have the wrong directory separator then your tests fail with this message:

Failure:
test case THREW exception:
Unable to create directory:

What it has failed to do is work out the path to put the received file in, since it can't properly parse the directory the test case is in.

I have patched this problem locally where I have seen it just by replacing "\" with "/" in the code. I don't know how to properly determine which directory separator to use on Windows, but it seems that #ifdef _WIN32 is not a good enough guide.

Dominant language
C++
Stars
339
Forks
55
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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.

More from approvals/ApprovalTests.cpp

All issues in approvals/ApprovalTests.cpp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.