-
Bug
-
Resolution: Cannot Reproduce
-
Not Evaluated
-
None
-
6.3.0
-
None
-
Windows, x64, Visual Studio 2022
Running this file produces an extra double quote at the end. I have other characters other than the single double quote. The last line should not be present in the text file.
Windows Registry Editor Version 5.00[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers] "C:\\Users\\Roger\\source\\repos\\Projects\\ImageViewers\\Tinta\\debug\\Tinta.exe"="RUNASADMIN" "
QString writeRegistry()
{
const QDir writableQDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
QString applicationPath = QDir().toNativeSeparators(QCoreApplication::applicationDirPath());
QString applicationFilePath = QCoreApplication::applicationFilePath();
QString registryLocation = writableQDir.absolutePath();
QString registryFileName = registryLocation + "/RegisterTinta.reg"; applicationFilePath.replace("/", "\\\\");
QFile file(registryFileName);
if (file.open(QIODevice::ReadWrite))
{
QTextStream stream(&file);
stream << "Windows Registry Editor Version 5.00\n\n";
stream << "[HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers]\n";
QString registryEntry = QString('"') + applicationFilePath + "\"=\"RUNASADMIN\"\n"; stream << registryEntry; file.close();
return registryFileName;
}
else
{
return {};
}
}