X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b9517a0ae450f70439f88abcab474ad60035b52c..c9d01afd8237e2a63c11f5ef4050d57a8651b2db:/src/common/mimetype.cpp diff --git a/src/common/mimetype.cpp b/src/common/mimetype.cpp index 30dc954880..ee32feae88 100644 --- a/src/common/mimetype.cpp +++ b/src/common/mimetype.cpp @@ -43,7 +43,7 @@ #ifdef __WXMSW__ #include "wx/msw/registry.h" #include "windows.h" -#elif defined(__UNIX__) +#elif defined(__UNIX__) || defined(__WXPM__) #include "wx/ffile.h" #include "wx/textfile.h" #include "wx/dir.h" @@ -1339,7 +1339,11 @@ void wxGNOMEIconHandler::Init() { wxArrayString dirs; dirs.Add(_T("/usr/share")); - dirs.Add(wxGetHomeDir() + _T("/.gnome")); + + wxString gnomedir; + wxGetHomeDir( &gnomedir ); + gnomedir += _T("/.gnome"); + dirs.Add( gnomedir ); size_t nDirs = dirs.GetCount(); for ( size_t nDir = 0; nDir < nDirs; nDir++ ) @@ -1381,7 +1385,7 @@ bool wxGNOMEIconHandler::GetIcon(const wxString& mimetype, wxIcon *icon) // KDE stores the icon info in its .kdelnk files. The file for mimetype/subtype // may be found in either of the following locations // -// 1. /usr/share/mimelnk/mimetype/subtype.kdelnk +// 1. $KDEDIR/share/mimelnk/mimetype/subtype.kdelnk // 2. ~/.kde/share/mimelnk/mimetype/subtype.kdelnk // // The format of a .kdelnk file is almost the same as the one used by @@ -1494,7 +1498,20 @@ void wxKDEIconHandler::LoadLinkFilesFromDir(const wxString& dirbase) void wxKDEIconHandler::Init() { wxArrayString dirs; - dirs.Add(_T("/usr/share")); + + // the variable KDEDIR is set when KDE is running + const char *kdedir = getenv("KDEDIR"); + if ( kdedir ) + { + dirs.Add(wxString(kdedir) + _T("/share")); + } + else + { + // try to guess KDEDIR + dirs.Add(_T("/usr/share")); + dirs.Add(_T("/opt/kde/share")); + } + dirs.Add(wxGetHomeDir() + _T("/.kde/share")); size_t nDirs = dirs.GetCount();