| 715 | ******************************************************************************/ |
| 716 | |
| 717 | FilePath ProjectEditor::openMigrationLog() noexcept { |
| 718 | if (!mMigrationLog) { |
| 719 | return FilePath(); |
| 720 | } |
| 721 | |
| 722 | // Important: Don't store the HTML in /tmp or ~/.cache because if LibrePCB |
| 723 | // runs in a sandbox, other apps may not have access to read those |
| 724 | // directories. In addition, even though the cache directory is globally |
| 725 | // readable by Snap and Flatpak applications, the Firefox and Chromium Snaps |
| 726 | // reject to open HTML files from those places. See: |
| 727 | // * https://bugs.launchpad.net/snapd/+bug/1972762 |
| 728 | // * https://askubuntu.com/questions/1370653/snap-apps-dont-find-files-in-tmp |
| 729 | // * https://librepcb.discourse.group/t/unable-to-see-messages-from-file-format-upgrade/1036. |
| 730 | // So we store the HTML in the project directory instead, but schedule it for |
| 731 | // deletion once the project is saved (leading to a new, final migration log). |
| 732 | const FilePath fp = |
| 733 | mProject->getPath().getPathTo(mMigrationLog->getRelativeFilePath(true)); |
| 734 | qInfo().nospace() << "Saving project migration log to " << fp.toNative() |
| 735 | << "..."; |
| 736 | try { |
| 737 | FileUtils::writeFile(fp, mMigrationLog->toHtml(true)); |
| 738 | DesktopServices ds(mWorkspace.getSettings()); |
| 739 | if (!ds.openLocalPath(fp)) { |
| 740 | throw RuntimeError( |
| 741 | __FILE__, __LINE__, |
| 742 | QString("Failed to open the file '%1' with the web browser.") |
| 743 | .arg(fp.toNative())); |
| 744 | } |
| 745 | } catch (const Exception& e) { |
| 746 | QMessageBox::critical(qApp->activeWindow(), "Error", e.getMsg()); |
| 747 | } |
| 748 | return fp; |
| 749 | } |
| 750 | |
| 751 | void ProjectEditor::scheduleErcRun() noexcept { |
| 752 | mErcTimer.start(mActiveSchematicTabs.isEmpty() ? 1000 : 100); |
nothing calls this directly
no test coverage detected