fix: test if it's green edition

This commit is contained in:
Roy Qu 2024-03-30 13:59:39 +08:00
parent daaf0b69cc
commit 7b60c9fa1d
2 changed files with 11 additions and 3 deletions

View File

@ -5626,7 +5626,7 @@ void MainWindow::onFileRenamedInFileSystemModel(const QString &path, const QStri
QString oldFile = folder.absoluteFilePath(oldName);
QString newFile = folder.absoluteFilePath(newName);
Editor *e = mEditorList->getOpenedEditorByFilename(path);
Editor *e = mEditorList->getOpenedEditorByFilename(oldFile);
if (e) {
e->setFilename(newFile);
}

View File

@ -327,12 +327,20 @@ bool isGreenEdition()
QString keyString = R"(Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++)";
QString systemInstallPath;
readRegistry(HKEY_LOCAL_MACHINE, keyString, "InstallLocation", systemInstallPath);
if (!systemInstallPath.isEmpty())
if (systemInstallPath.isEmpty()) {
readRegistry(HKEY_LOCAL_MACHINE, keyString, "UninstallString", systemInstallPath);
systemInstallPath = excludeTrailingPathDelimiter(extractFileDir(systemInstallPath));
} else
systemInstallPath = excludeTrailingPathDelimiter(systemInstallPath);
QString userInstallPath;
readRegistry(HKEY_CURRENT_USER, keyString, "InstallLocation", userInstallPath);
if (!userInstallPath.isEmpty())
if (userInstallPath.isEmpty()) {
readRegistry(HKEY_CURRENT_USER, keyString, "UninstallString", userInstallPath);
userInstallPath = excludeTrailingPathDelimiter(extractFileDir(userInstallPath));
} else
userInstallPath = excludeTrailingPathDelimiter(userInstallPath);
systemInstallPath = localizePath(systemInstallPath);
userInstallPath = localizePath(userInstallPath);
gIsGreenEdition = appPath.compare(systemInstallPath, Qt::CaseInsensitive) != 0 &&
appPath.compare(userInstallPath, Qt::CaseInsensitive) != 0;
gIsGreenEditionInited = true;