File: fix-default-settings

package info (click to toggle)
cppcheck 1.86-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 14,600 kB
  • sloc: cpp: 169,157; python: 6,329; ansic: 3,848; xml: 847; makefile: 563; sh: 429; cs: 291
file content (32 lines) | stat: -rw-r--r-- 1,197 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Description: Set DATADIR default to CFGDIR
Author: Joachim Reichel <reichel@debian.org>

Index: cppcheck-1.86/gui/main.cpp
===================================================================
--- cppcheck-1.86.orig/gui/main.cpp
+++ cppcheck-1.86/gui/main.cpp
@@ -62,6 +62,12 @@ int main(int argc, char *argv[])
 
     QSettings* settings = new QSettings("Cppcheck", "Cppcheck-GUI", &app);
 
+    // Set some default settings
+    if( settings->value("DATADIR", QString()).toString().isEmpty())
+        settings->setValue("DATADIR", CFGDIR);
+    if( settings->value(SETTINGS_PYTHON_PATH, QString()).toString().isEmpty())
+        settings->setValue(SETTINGS_PYTHON_PATH, QString("/usr/bin/python3"));
+
     // Set data dir..
     foreach (const QString arg, app.arguments()) {
         if (arg.startsWith("--data-dir=")) {
Index: cppcheck-1.86/gui/gui.pro
===================================================================
--- cppcheck-1.86.orig/gui/gui.pro
+++ cppcheck-1.86/gui/gui.pro
@@ -9,6 +9,7 @@ INCLUDEPATH += . \
     ../lib
 QT += widgets
 QT += printsupport
+DEFINES += CFGDIR=\\\"/usr/share/cppcheck/cfg\\\"
 
 contains(LINKCORE, [yY][eE][sS]) {
     LIBS += -l../bin/cppcheck-core