#pragma once #include // Escape shell-sensitive characters in a path by prefixing each with a // backslash. Mirrors ghostty's Ghostty.Shell.escape // (macos/Sources/Ghostty/Ghostty.Shell.swift): the character set and its // order are upstream's, and the literal backslash is first so the // backslashes inserted below are never re-escaped. [[nodiscard]] inline QString shellEscapePath(const QString& path) { static const QString kEscape = QStringLiteral("\\ ()[]{}<>\"'`!#$&;|*?\t"); QString out = path; for (const QChar ch : kEscape) { out.replace(ch, QStringLiteral("\\") + ch); } return out; }