1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Linux: When not under Gnome/KDE, use xdg-open to open the mounted volume if it is available.

This commit is contained in:
Mounir IDRASSI
2015-02-08 13:45:15 +01:00
parent 96b39a5973
commit ad4af09d88

View File

@@ -832,7 +832,7 @@ namespace VeraCrypt
// MIME handler for directory seems to be unavailable through wxWidgets
wxString desktop = GetTraits()->GetDesktopEnvironment();
if (desktop == L"GNOME" || desktop.empty())
if (desktop == L"GNOME")
{
args.push_back ("--no-default-window");
args.push_back ("--no-desktop");
@@ -865,6 +865,22 @@ namespace VeraCrypt
catch (exception &e) { ShowError (e); }
}
}
else if (wxFileName::IsFileExecutable (wxT("/usr/bin/xdg-open")))
{
// Fallback on the standard xdg-open command
// which is not always available by default
args.push_back (string (path));
try
{
Process::Execute ("xdg-open", args, 2000);
}
catch (TimeOut&) { }
catch (exception &e) { ShowError (e); }
}
else
{
ShowWarning (wxT("Unable to find a file manager to open the mounted volume"));
}
#endif
}