| 72 | } |
| 73 | |
| 74 | QString commandForScratch(const QFileInfo& file) |
| 75 | { |
| 76 | if (scratchCommands().hasKey(file.fileName())) { |
| 77 | return scratchCommands().readEntry(file.fileName()); |
| 78 | } |
| 79 | |
| 80 | const auto suffix = file.suffix(); |
| 81 | if (mimeCommands().hasKey(suffix)) { |
| 82 | return mimeCommands().readEntry(suffix); |
| 83 | } |
| 84 | |
| 85 | const static QHash<QString, QString> defaultCommands = { |
| 86 | {QStringLiteral("cpp"), QStringLiteral("g++ -std=c++20 -o /tmp/a.out $f && /tmp/a.out")}, |
| 87 | {QStringLiteral("py"), QStringLiteral("python $f")}, |
| 88 | {QStringLiteral("js"), QStringLiteral("node $f")}, |
| 89 | {QStringLiteral("c"), QStringLiteral("gcc -o /tmp/a.out $f && /tmp/a.out")}, |
| 90 | }; |
| 91 | |
| 92 | return defaultCommands.value(suffix); |
| 93 | } |
| 94 | |
| 95 | [[nodiscard]] QString initializeDataDirectory() |
| 96 | { |
no test coverage detected