Skip to content

Commit

Permalink
Be tolerant of failure to load file icons on Windows
Browse files Browse the repository at this point in the history
File icons loader is not 100% reliable because it doesn't fully support
all possible syntaxes. For example, files associated with Notepad on
Windows 11 will have a weird non-path like
@{Microsoft.WindowsNotepad_11.***?ms-resource://***/txtfile.png}
which is not worth parsing.

Not showing an icon is fine, but throwing error messages at the user,
particularly ones they cannot resolve, is not.
  • Loading branch information
vslavik committed Aug 1, 2023
1 parent 2960a6f commit 8b564aa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/recent_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ class file_icons
fullname << ';' << loc.GetIndex();
}
#endif
// suppress logging of icon loading errors beyond our control:
wxLogNull nolog;

wxIcon icon(fullname, wxBITMAP_TYPE_ICO, desiredSize, desiredSize);
if (!icon.IsOk())
icon.LoadFile(fullname, wxBITMAP_TYPE_ICO);
Expand Down

0 comments on commit 8b564aa

Please sign in to comment.