From 509a619604a69bb8ba1e6e64913c9021480d35a6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 10 Dec 1999 17:31:44 +0000 Subject: [PATCH] use KDEDIR in wxKDEIconHandler git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/mimetype.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/common/mimetype.cpp b/src/common/mimetype.cpp index 8b895d7dee..38c3927711 100644 --- a/src/common/mimetype.cpp +++ b/src/common/mimetype.cpp @@ -1385,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 @@ -1498,12 +1498,21 @@ void wxKDEIconHandler::LoadLinkFilesFromDir(const wxString& dirbase) void wxKDEIconHandler::Init() { wxArrayString dirs; - dirs.Add(_T("/usr/share")); - - wxString kdedir; - wxGetHomeDir( &kdedir ); - kdedir += _T("/.kde/share"); - dirs.Add( kdedir ); + + // 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(); for ( size_t nDir = 0; nDir < nDirs; nDir++ ) -- 2.45.2