Skip to content

Commit

Permalink
Partial fix for #12254 (cppcheck.cfg can't be loaded from relative pa…
Browse files Browse the repository at this point in the history
…ths anymore) (danmar#5760)
  • Loading branch information
danmar committed Dec 13, 2023
1 parent b26b78b commit bc50237
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cli/cmdlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1629,10 +1629,10 @@ void CmdLineParser::printHelp() const
mLogger.printRaw(oss.str());
}

bool CmdLineParser::isCppcheckPremium() {
Settings settings;
settings.loadCppcheckCfg(); // TODO: how to handle errors?
return startsWith(settings.cppcheckCfgProductName, "Cppcheck Premium");
bool CmdLineParser::isCppcheckPremium() const {
if (mSettings.cppcheckCfgProductName.empty())
mSettings.loadCppcheckCfg();
return startsWith(mSettings.cppcheckCfgProductName, "Cppcheck Premium");
}

bool CmdLineParser::tryLoadLibrary(Library& destination, const std::string& basepath, const char* filename)
Expand Down
2 changes: 1 addition & 1 deletion cli/cmdlineparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class CmdLineParser {
void printHelp() const;

private:
static bool isCppcheckPremium();
bool isCppcheckPremium() const;

template<typename T>
bool parseNumberArg(const char* const arg, std::size_t offset, T& num, bool mustBePositive = false)
Expand Down

0 comments on commit bc50237

Please sign in to comment.