When calling cppcheck from command line : cppcheck --project=Cppcheck/Project.cppcheck directly from MyProject/ path, with a custom platform.xml on Cppcheck/ project directory the platform file is not found.
Looking at the code : else if (!mSettings->loadPlatformFile(argv[0], platform)) { argv[0] is the path from where we are calling cppcheck MyProject/ but that would be better to check in the path where the project file Project.cppcheck is located as everything should be relative to this file location Cppcheck/
Hi,
Assuming following project structure
When calling cppcheck from command line :
cppcheck --project=Cppcheck/Project.cppcheck
directly fromMyProject/
path, with a customplatform.xml
onCppcheck/
project directory the platform file is not found.Looking at the code :
else if (!mSettings->loadPlatformFile(argv[0], platform)) {
argv[0]
is the path from where we are calling cppcheckMyProject/
but that would be better to check in the path where the project fileProject.cppcheck
is located as everything should be relative to this file locationCppcheck/
https://github.com/danmar/cppcheck/blob/141d2ac215c25dd60ca8230eca053756da832279/cli/cmdlineparser.cpp#L627
Thanks! I will investigate this. Well replacing argv[0] is not a good idea neither we want to be able to load platform files in the binary path.
I believe I have fixed this let us know if you will continue to see problems.
Thank you very much this was a fast fix !
I will give it a try soon and keep yoy updated.
Just one thing I seen 2x the same line here :
filenames.push_back(Path::getPathFromFilename(Path::fromNativeSeparators(exename))
Does the second one should not have
+ ".xml"
?Thanks, it works perfectly!