From 6f9d01a2829cc0a210dc06b86c9cd9c06994dd6e Mon Sep 17 00:00:00 2001 From: sgourdas Date: Mon, 5 Aug 2024 22:23:28 +0300 Subject: [PATCH] Disable sandbox when run from Windows shared drive --- src/main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 5b85fff..1db5373 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,6 +5,10 @@ #include #include #include +#ifdef Q_OS_WIN + #include + #include +#endif #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) #include #endif @@ -18,6 +22,15 @@ int main(int argc, char *argv[]) } // End of hack ^^^ +#ifdef Q_OS_WIN + std::string driveLetter = kiwix::getExecutablePath().substr(0, 3); + qInfo() << driverLetter; + UINT driveType = GetDriveTypeA(driveLetter.c_str()); + if(driveType == DRIVE_REMOTE) { + qputenv("QTWEBENGINE_CHROMIUM_FLAGS", QByteArray("--no-sandbox")); + qInfo() << "Disabled sandbox"; + } +#endif #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // High DPI Scaling is enabled by default in Qt6. This attribute no longer exists in 6.0 and later QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);