| 1861 | } |
| 1862 | |
| 1863 | void MainWindow::analyzeProject(const ProjectFile *projectFile, const QStringList& recheckFiles, const bool checkLib, const bool checkConfig) |
| 1864 | { |
| 1865 | Settings::terminate(false); |
| 1866 | |
| 1867 | QFileInfo inf(projectFile->getFilename()); |
| 1868 | const QString& rootpath = projectFile->getRootPath(); |
| 1869 | |
| 1870 | QDir::setCurrent(inf.absolutePath()); |
| 1871 | |
| 1872 | mThread->setAddonsAndTools(projectFile->getAddonsAndTools()); |
| 1873 | |
| 1874 | // If the root path is not given or is not "current dir", use project |
| 1875 | // file's location directory as root path |
| 1876 | if (rootpath.isEmpty() || rootpath == ".") |
| 1877 | mCurrentDirectory = inf.canonicalPath(); |
| 1878 | else if (rootpath.startsWith("./")) |
| 1879 | mCurrentDirectory = inf.canonicalPath() + rootpath.mid(1); |
| 1880 | else |
| 1881 | mCurrentDirectory = rootpath; |
| 1882 | |
| 1883 | if (!projectFile->getBuildDir().isEmpty()) { |
| 1884 | QString buildDir = projectFile->getBuildDir(); |
| 1885 | if (!QDir::isAbsolutePath(buildDir)) |
| 1886 | buildDir = inf.canonicalPath() + '/' + buildDir; |
| 1887 | if (!QDir(buildDir).exists()) { |
| 1888 | QMessageBox msg(QMessageBox::Question, |
| 1889 | tr("Cppcheck"), |
| 1890 | tr("Build dir '%1' does not exist, create it?").arg(buildDir), |
| 1891 | QMessageBox::Yes | QMessageBox::No, |
| 1892 | this); |
| 1893 | if (msg.exec() == QMessageBox::Yes) { |
| 1894 | QDir().mkpath(buildDir); |
| 1895 | } else if (!projectFile->getAddons().isEmpty()) { |
| 1896 | QMessageBox m(QMessageBox::Critical, |
| 1897 | tr("Cppcheck"), |
| 1898 | tr("To check the project using addons, you need a build directory."), |
| 1899 | QMessageBox::Ok, |
| 1900 | this); |
| 1901 | m.exec(); |
| 1902 | return; |
| 1903 | } |
| 1904 | } |
| 1905 | } |
| 1906 | |
| 1907 | if (!projectFile->getImportProject().isEmpty()) { |
| 1908 | ImportProject p; |
| 1909 | QString prjfile; |
| 1910 | |
| 1911 | if (QFileInfo(projectFile->getImportProject()).isAbsolute()) { |
| 1912 | prjfile = projectFile->getImportProject(); |
| 1913 | } else { |
| 1914 | prjfile = inf.canonicalPath() + '/' + projectFile->getImportProject(); |
| 1915 | } |
| 1916 | try { |
| 1917 | |
| 1918 | const ImportProject::Type result = p.import(prjfile.toStdString()); |
| 1919 | |
| 1920 | QString errorMessage; |
nothing calls this directly
no test coverage detected