#pragma once #include #include #include namespace UpdateClient { inline bool isRuntimeProtectedPath(const QString& path, const QString& runtimeRelativePath) { const QString normalizedPath = QDir::cleanPath(QDir::fromNativeSeparators(path)).toCaseFolded(); static const QSet protectedPaths{ QStringLiteral("bootstrap.exe"), QStringLiteral("client.ini"), QStringLiteral("config/app_config.json"), QStringLiteral("config/local_state.json"), QStringLiteral("config/client_identity.dat"), QStringLiteral("config/version_policy.dat") }; if (protectedPaths.contains(normalizedPath)) return true; QString runtimePrefix = QDir::cleanPath( QDir::fromNativeSeparators(runtimeRelativePath)).toCaseFolded(); if (runtimePrefix.isEmpty() || runtimePrefix == QStringLiteral(".")) return false; while (runtimePrefix.startsWith(QStringLiteral("./"))) runtimePrefix.remove(0, 2); for (const QString& protectedPath : protectedPaths) { if (normalizedPath == runtimePrefix + QLatin1Char('/') + protectedPath) return true; } return false; } }