Partially fixed detection of multiple editors on Windows (setting default is still broken)
This commit is contained in:
parent
01716264c2
commit
a2548d1319
|
@ -184,36 +184,37 @@ void ApplicationList::Clear()
|
||||||
|
|
||||||
bool ApplicationList::FindDefaultWindowsEditor()
|
bool ApplicationList::FindDefaultWindowsEditor()
|
||||||
{
|
{
|
||||||
|
bool foundOne = false;
|
||||||
const QString appPath(getenv("ProgramFiles"));
|
const QString appPath(getenv("ProgramFiles"));
|
||||||
const QString notepadppPath = appPath + "\\Notepad++\\notepad++.exe";
|
const QString notepadppPath = appPath + "\\Notepad++\\notepad++.exe";
|
||||||
if (QFileInfo(notepadppPath).isExecutable()) {
|
if (QFileInfo(notepadppPath).exists() && QFileInfo(notepadppPath).isExecutable()) {
|
||||||
Application app;
|
Application app;
|
||||||
app.setName("Notepad++");
|
app.setName("Notepad++");
|
||||||
app.setPath("\"" + notepadppPath + "\"");
|
app.setPath("\"" + notepadppPath + "\"");
|
||||||
app.setParameters("-n(line) (file)");
|
app.setParameters("-n(line) (file)");
|
||||||
AddApplication(app);
|
AddApplication(app);
|
||||||
return true;
|
foundOne = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString notepadTwoPath = appPath + "\\Notepad2\\Notepad2.exe";
|
const QString notepadTwoPath = appPath + "\\Notepad2\\Notepad2.exe";
|
||||||
if (QFileInfo(notepadTwoPath).isExecutable()) {
|
if (QFileInfo(notepadTwoPath).exists() && QFileInfo(notepadTwoPath).isExecutable()) {
|
||||||
Application app;
|
Application app;
|
||||||
app.setName("Notepad2");
|
app.setName("Notepad2");
|
||||||
app.setPath("\"" + notepadTwoPath + "\"");
|
app.setPath("\"" + notepadTwoPath + "\"");
|
||||||
app.setParameters("/g (line) (file)");
|
app.setParameters("/g (line) (file)");
|
||||||
AddApplication(app);
|
AddApplication(app);
|
||||||
return true;
|
foundOne = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString windowsPath(getenv("windir"));
|
const QString windowsPath(getenv("windir"));
|
||||||
const QString notepadPath = windowsPath + "\\system32\\notepad.exe";
|
const QString notepadPath = windowsPath + "\\system32\\notepad.exe";
|
||||||
if (QFileInfo(notepadPath).isExecutable()) {
|
if (QFileInfo(notepadPath).exists() && QFileInfo(notepadPath).isExecutable()) {
|
||||||
Application app;
|
Application app;
|
||||||
app.setName("Notepad");
|
app.setName("Notepad");
|
||||||
app.setPath(notepadPath);
|
app.setPath(notepadPath);
|
||||||
app.setParameters("(file)");
|
app.setParameters("(file)");
|
||||||
AddApplication(app);
|
AddApplication(app);
|
||||||
return true;
|
foundOne = true;
|
||||||
}
|
}
|
||||||
return false;
|
return foundOne;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue