MCPcopy Create free account
hub / github.com/ElyPrismLauncher/Launcher / quoteArgs

Function quoteArgs

launcher/FileSystem.cpp:901–922  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

899}
900
901QString quoteArgs(const QStringList& args, const QString& wrap, const QString& escapeChar, bool wrapOnlyIfNeeded = false)
902{
903 QString result;
904
905 auto size = args.size();
906 for (int i = 0; i < size; ++i) {
907 QString arg = args[i];
908 arg.replace(wrap, escapeChar);
909
910 bool needsWrapping = !wrapOnlyIfNeeded || arg.contains(' ') || arg.contains('\t') || arg.contains(wrap);
911
912 if (needsWrapping)
913 result += wrap + arg + wrap;
914 else
915 result += arg;
916
917 if (i < size - 1)
918 result += ' ';
919 }
920
921 return result;
922}
923
924// Cross-platform Shortcut creation
925QString createShortcut(QString destination, QString target, QStringList args, QString name, QString icon)

Callers 1

createShortcutFunction · 0.85

Calls 3

sizeMethod · 0.45
replaceMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected