E Text Editor | The Power of Textmate on Windows

 
Author Message

Index  >  Development  ~  Linux ProjectPane issue (+ fix!)

wvdschel
Posted: Sat Apr 18, 2009 10:50 pm Reply with quote
Registered User Joined: 18 Apr 2009 Posts: 3
Hi, I've been trying to build E on Linux today (Fedora 10 to be exact), and I've gotten to the point that E builds and runs, but it still has many problems. Besides the constant popups about failed assertions, I also couldn't see any files because wxTheMimeTypesManager failed to resolve the extensions.

While this issue is with not E's fault (the mimetype list on my system is simply incomplete), the way E handled this was kind of strange: it just bailed out. The result was that all files with an extension that didn't resolve were not displayed in the ProjectPane.

I've modified the code so that when the mime type can't be resolved, the default file icon is used. The fix shouldn't break anything else, so I hope please use it:

Here is the patch:

Code:
--- a/src/ProjectPane.cpp
+++ b/src/ProjectPane.cpp
@@ -2138,7 +2138,12 @@ bool ProjectPane::GetIconFromFilePath(const wxString& path, wxIcon &icon) {
        if (NULL == (FileType = wxTheMimeTypesManager->GetFileTypeFromExtension(FileExt))) {
                wxLogDebug(wxT("ProjectPane::%s() Can't get file type from ext=%s"),
                        wxString(__FUNCTION__, wxConvUTF8).c_str(), FileExt.c_str());
-               return false;
+               // FIX: use default icon here as well.
+               icon = wxArtProvider::GetIcon(wxART_NORMAL_FILE);
+                if (!icon.IsOk()) {
+                        return false;
+                }
+                return true;
        }
        if ((!FileType->GetIcon(&IconLoc)) || !IconLoc.IsOk()) {
                wxLogDebug(wxT("ProjectPane::%s() Can't get icon location"),
View user's profile Send private message
Alexander Stigsen
Posted: Mon Apr 20, 2009 2:35 pm Reply with quote
e Developer Joined: 31 Jul 2005 Posts: 468
Thanks for the fix. Could you create your own fork on GitHub and and add it there, then you will keep credit for the change when merged into the main tree.
View user's profile Send private message Send e-mail Visit poster's website

Display posts from previous:  

All times are GMT
Page 1 of 1
Post new topic

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum