Use only existing directories in Unix wxMimeTypesManager
Avoid using directories under /opt if they don't exist anyhow. This also makes the code easier to modify in the future, see #16704.
This commit is contained in:
@@ -520,6 +520,11 @@ void wxMimeTypesManagerImpl::InitIfNeeded()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void AppendToPathIfExists(wxString& pathvar, const wxString& dir)
|
||||||
|
{
|
||||||
|
if ( wxFileName::DirExists(dir) )
|
||||||
|
pathvar << ":" << dir;
|
||||||
|
}
|
||||||
|
|
||||||
// read system and user mailcaps and other files
|
// read system and user mailcaps and other files
|
||||||
void wxMimeTypesManagerImpl::Initialize(int mailcapStyles,
|
void wxMimeTypesManagerImpl::Initialize(int mailcapStyles,
|
||||||
@@ -546,10 +551,18 @@ void wxMimeTypesManagerImpl::Initialize(int mailcapStyles,
|
|||||||
if ( xdgDataDirs.empty() )
|
if ( xdgDataDirs.empty() )
|
||||||
{
|
{
|
||||||
xdgDataDirs = "/usr/local/share:/usr/share";
|
xdgDataDirs = "/usr/local/share:/usr/share";
|
||||||
if (mailcapStyles & wxMAILCAP_GNOME)
|
|
||||||
xdgDataDirs += ":/usr/share/gnome:/opt/gnome/share";
|
if ( mailcapStyles & wxMAILCAP_GNOME )
|
||||||
if (mailcapStyles & wxMAILCAP_KDE)
|
{
|
||||||
xdgDataDirs += ":/usr/share/kde3:/opt/kde3/share";
|
AppendToPathIfExists(xdgDataDirs, "/usr/share/gnome");
|
||||||
|
AppendToPathIfExists(xdgDataDirs, "/opt/gnome/share");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mailcapStyles & wxMAILCAP_KDE )
|
||||||
|
{
|
||||||
|
AppendToPathIfExists(xdgDataDirs, "/usr/share/kde3");
|
||||||
|
AppendToPathIfExists(xdgDataDirs, "/opt/kde3/share");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( !sExtraDir.empty() )
|
if ( !sExtraDir.empty() )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user