Skip to content

Commit a2548d1

Browse files
committed
Partially fixed detection of multiple editors on Windows (setting default is still broken)
1 parent 0171626 commit a2548d1

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

gui/applicationlist.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,36 +184,37 @@ void ApplicationList::Clear()
184184

185185
bool ApplicationList::FindDefaultWindowsEditor()
186186
{
187+
bool foundOne = false;
187188
const QString appPath(getenv("ProgramFiles"));
188189
const QString notepadppPath = appPath + "\\Notepad++\\notepad++.exe";
189-
if (QFileInfo(notepadppPath).isExecutable()) {
190+
if (QFileInfo(notepadppPath).exists() && QFileInfo(notepadppPath).isExecutable()) {
190191
Application app;
191192
app.setName("Notepad++");
192193
app.setPath("\"" + notepadppPath + "\"");
193194
app.setParameters("-n(line) (file)");
194195
AddApplication(app);
195-
return true;
196+
foundOne = true;
196197
}
197198

198199
const QString notepadTwoPath = appPath + "\\Notepad2\\Notepad2.exe";
199-
if (QFileInfo(notepadTwoPath).isExecutable()) {
200+
if (QFileInfo(notepadTwoPath).exists() && QFileInfo(notepadTwoPath).isExecutable()) {
200201
Application app;
201202
app.setName("Notepad2");
202203
app.setPath("\"" + notepadTwoPath + "\"");
203204
app.setParameters("/g (line) (file)");
204205
AddApplication(app);
205-
return true;
206+
foundOne = true;
206207
}
207208

208209
const QString windowsPath(getenv("windir"));
209210
const QString notepadPath = windowsPath + "\\system32\\notepad.exe";
210-
if (QFileInfo(notepadPath).isExecutable()) {
211+
if (QFileInfo(notepadPath).exists() && QFileInfo(notepadPath).isExecutable()) {
211212
Application app;
212213
app.setName("Notepad");
213214
app.setPath(notepadPath);
214215
app.setParameters("(file)");
215216
AddApplication(app);
216-
return true;
217+
foundOne = true;
217218
}
218-
return false;
219+
return foundOne;
219220
}

0 commit comments

Comments
 (0)