7272static const QString OnlineHelpURL (" https://cppcheck.sourceforge.io/manual.html" );
7373static const QString compile_commands_json (" compile_commands.json" );
7474
75+ static QString fromNativePath (const QString& p) {
76+ #ifdef Q_OS_WIN
77+ QString ret (p);
78+ ret.replace (' \\ ' , ' /' );
79+ return ret;
80+ #else
81+ return p;
82+ #endif
83+ }
84+
7585MainWindow::MainWindow (TranslationHandler* th, QSettings* settings) :
7686 mSettings(settings),
7787 mApplications(new ApplicationList(this )),
@@ -913,7 +923,7 @@ Settings MainWindow::getCppcheckSettings()
913923 if (!mProjectFile ->getImportProject ().isEmpty ())
914924 result.checkAllConfigurations = false ;
915925
916- const QString &buildDir = mProjectFile ->getBuildDir ();
926+ const QString &buildDir = fromNativePath ( mProjectFile ->getBuildDir () );
917927 if (!buildDir.isEmpty ()) {
918928 if (QDir (buildDir).isAbsolute ()) {
919929 result.buildDir = buildDir.toStdString ();
@@ -949,7 +959,7 @@ Settings MainWindow::getCppcheckSettings()
949959 result.checkUnknownFunctionReturn .insert (s.toStdString ());
950960
951961 QString filesDir (getDataDir ());
952- const QString pythonCmd = mSettings ->value (SETTINGS_PYTHON_PATH).toString ();
962+ const QString pythonCmd = fromNativePath ( mSettings ->value (SETTINGS_PYTHON_PATH).toString () );
953963 for (const QString& addon : mProjectFile ->getAddons ()) {
954964 QString addonFilePath = ProjectFile::getAddonFilePath (filesDir, addon);
955965 if (addonFilePath.isEmpty ())
@@ -961,7 +971,7 @@ Settings MainWindow::getCppcheckSettings()
961971 json += " { \" script\" :\" " + addonFilePath + " \" " ;
962972 if (!pythonCmd.isEmpty ())
963973 json += " , \" python\" :\" " + pythonCmd + " \" " ;
964- QString misraFile = mSettings ->value (SETTINGS_MISRA_FILE).toString ();
974+ QString misraFile = fromNativePath ( mSettings ->value (SETTINGS_MISRA_FILE).toString () );
965975 if (addon == " misra" && !misraFile.isEmpty ()) {
966976 QString arg;
967977 if (misraFile.endsWith (" .pdf" , Qt::CaseInsensitive))
@@ -1102,7 +1112,7 @@ void MainWindow::checkLockDownUI()
11021112
11031113void MainWindow::programSettings ()
11041114{
1105- SettingsDialog dialog (mApplications , mTranslation , this );
1115+ SettingsDialog dialog (mApplications , mTranslation , isCppcheckPremium (), this );
11061116 if (dialog.exec () == QDialog::Accepted) {
11071117 dialog.saveSettingValues ();
11081118 mSettings ->sync ();
0 commit comments