MCPcopy Create free account
hub / github.com/KDE/kdevelop / commandForScratch

Function commandForScratch

plugins/scratchpad/scratchpad.cpp:74–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74QString 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{

Callers 1

addFileToModelMethod · 0.85

Calls 6

scratchCommandsFunction · 0.85
mimeCommandsFunction · 0.85
readEntryMethod · 0.80
hasKeyMethod · 0.45
fileNameMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected