Comments (5)
After Reading issue #196 i tried to change some settings in QT Creator.
By changing the generator from ninja to MinGW Makefiles it works.
This is the interesting part of the working output
__FILE__ == C:\Users\florian.fischer\Documents\inmach\src\approvalTest_problem\path_problem_demo\test.cpp
This time the filename contains backslashes instead of slashes.
from approvaltests.cpp.
I did some more investigation of this issue
g++ just copy the filname passed on commandline into FILE
when i use this command
g++.exe .//////.\\\\./.\\./foo.cpp
it prints
.//////.\\./.\./foo.cpp
I think you should normalize the Seperators.
It seems you have there something prepared.
Path::normalizeSeparators
Path::removeRedundantDirectorySeparators
But according to the debugger in qt-creator they are never called
from approvaltests.cpp.
Hello @Florian-Fischer-InMach
Many thanks for this clear report.
We've had a lot of trouble with the Ninja generator previously, and believed that we had worked through all the possible causes.
Here's what we wrote up previously about possible workarounds.
If none of those help, would you be interested in pairing with me, via screen sharing from your machine, to find a solution?
from approvaltests.cpp.
Hello @claremacrae
Sry for late answer. Was busy with other stuff.
I have read the workarounds but they do not solve my problem because they are all about getting abolute Paths.
My problem is: Wrong path seperators.
Ninja generates paths with "/".
getDirectorySeparator returns "".
string magic on path fails because of no match
I changed my Hack from the beginning to this:
Florian-Fischer-InMach@84e1a39
It simply calls normalizeSeparators to fix the sepearators in function setFileName
If you want further discussions we can do a screen sharing to improve this fix
from approvaltests.cpp.
I'm cross-compiling from Linux to windows, using mingw. And I bumped into the same problem. I solved it by patching
std::string ApprovalTestNamer::getSourceFileName() const
{
auto file = getCurrentTest().getFileName();
+ file = Path(file).toString();
auto start = file.rfind(SystemUtils::getDirectorySeparator()) + 1;
auto end = file.rfind('.');
auto fileName = file.substr(start, end - start);
return convertToFileName(fileName);
}
...
std::string FileUtils::getDirectory(const std::string& filePath)
{
- auto end = filePath.rfind(SystemUtils::getDirectorySeparator()) + 1;
- auto directory = filePath.substr(0, end);
+ auto filePath2 = Path(filePath).toString();
+ auto end = filePath2.rfind(SystemUtils::getDirectorySeparator()) + 1;
+ auto directory = filePath2.substr(0, end);
return directory;
}
But in the end, Florian-Fischer-InMach@84e1a39 works as well. Why it is not in the master branch yet? This problem is known for at least 2 years.
from approvaltests.cpp.
Related Issues (20)
- Add a copyright statement to the released single header HOT 1
- GitHub Actions: Don't run scheduled tasks on forked repos
- Using kdiff3 as diff tool, user has to specify name of output file after merge
- cygwin CI build hangs for 6 hours then fails HOT 5
- warning C4459 in MSVC with /W4 HOT 1
- Does not compile with clang13 due to -Werror/-Wdeprecated-copy-with-dtor HOT 2
- Ninja + Catch2 + mingw64
- useApprovalsSubdirectory() doesn't create the output directory in the expected location HOT 3
- with CppUTest: `ApprovalMismatchException` suppresses other tests output HOT 4
- add `code -d {Received} {Approved}` to Reporters list
- Catch2 integration does not handle Generators inside sections HOT 1
- Catch2 v3 integration HOT 5
- Bug with {fmt} integration HOT 2
- CLion reporter does not open correctly if CLion is already open
- In-lining test output (as opposed to saving in files) HOT 4
- Support for catch2 v3.x.x HOT 2
- Diffing tool is never prompted to open HOT 13
- Impossible to use UNC filename in TemplatedCustomNamer [`removeRedundantDirectorySeparators()` breaks use of UNC paths, which contain `\\`] HOT 5
- _mkdir fails when asked to create more than one directory HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from approvaltests.cpp.