MCPcopy Create free account
hub / github.com/cpeditor/cpeditor / setFilePath

Method setFilePath

src/mainwindow.cpp:421–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421void MainWindow::setFilePath(QString path, bool updateBinder)
422{
423 if (QFile::exists(path))
424 path = QFileInfo(path).canonicalFilePath();
425 LOG_INFO(INFO_OF(path));
426 if (filePath == path)
427 {
428 updateWatcher();
429 return;
430 }
431 filePath = path;
432 if (updateBinder)
433 FileProblemBinder::set(path, problemURL);
434 if (!isUntitled())
435 {
436 auto recentFiles = SettingsHelper::getRecentFiles();
437 recentFiles.removeAll(filePath);
438 recentFiles.push_front(filePath);
439 if (recentFiles.length() > MAX_NUMBER_OF_RECENT_FILES)
440 recentFiles.erase(recentFiles.begin() + MAX_NUMBER_OF_RECENT_FILES, recentFiles.end());
441 SettingsHelper::setRecentFiles(recentFiles);
442
443 emit requestUpdateLanguageServerFilePath(this, path);
444 }
445 emit editorFileChanged();
446 updateWatcher();
447}
448
449void MainWindow::setProblemURL(const QString &url)
450{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected