mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-30 23:13:31 +01:00
Linux/MacOSX: Load preferences if only volume path is given in command line and GUI mode enabled.
This commit is contained in:
parent
f80f7d47d5
commit
279c99fdf8
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
namespace VeraCrypt
|
namespace VeraCrypt
|
||||||
{
|
{
|
||||||
CommandLineInterface::CommandLineInterface (wxCmdLineParser &parser, UserInterfaceType::Enum interfaceType) :
|
CommandLineInterface::CommandLineInterface (int argc, wchar_t** argv, UserInterfaceType::Enum interfaceType) :
|
||||||
ArgCommand (CommandId::None),
|
ArgCommand (CommandId::None),
|
||||||
ArgFilesystem (VolumeCreationOptions::FilesystemType::Unknown),
|
ArgFilesystem (VolumeCreationOptions::FilesystemType::Unknown),
|
||||||
ArgNoHiddenVolumeProtection (false),
|
ArgNoHiddenVolumeProtection (false),
|
||||||
@ -26,6 +26,9 @@ namespace VeraCrypt
|
|||||||
ArgTrueCryptMode (false),
|
ArgTrueCryptMode (false),
|
||||||
StartBackgroundTask (false)
|
StartBackgroundTask (false)
|
||||||
{
|
{
|
||||||
|
wxCmdLineParser parser;
|
||||||
|
parser.SetCmdLine (argc, argv);
|
||||||
|
|
||||||
parser.SetSwitchChars (L"-");
|
parser.SetSwitchChars (L"-");
|
||||||
|
|
||||||
parser.AddOption (L"", L"auto-mount", _("Auto mount device-hosted/favorite volumes"));
|
parser.AddOption (L"", L"auto-mount", _("Auto mount device-hosted/favorite volumes"));
|
||||||
@ -475,6 +478,22 @@ namespace VeraCrypt
|
|||||||
// Parameters
|
// Parameters
|
||||||
if (parser.GetParamCount() > 0)
|
if (parser.GetParamCount() > 0)
|
||||||
{
|
{
|
||||||
|
// in case of GUI interface, we load the preference when only
|
||||||
|
// specifying volume path without any option/switch
|
||||||
|
if (Application::GetUserInterfaceType() != UserInterfaceType::Text)
|
||||||
|
{
|
||||||
|
// check if only parameters were specified in the command line
|
||||||
|
// (e.g. when associating .hc extension in mimetype with /usr/bin/veracrypt)
|
||||||
|
bool onlyParametersPresent = (parser.GetParamCount() == (size_t) (argc - 1));
|
||||||
|
|
||||||
|
if (onlyParametersPresent)
|
||||||
|
{
|
||||||
|
// no options/switches, so we load prefences now
|
||||||
|
Preferences.Load();
|
||||||
|
ArgMountOptions = Preferences.DefaultMountOptions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ArgCommand == CommandId::None)
|
if (ArgCommand == CommandId::None)
|
||||||
{
|
{
|
||||||
ArgCommand = CommandId::MountVolume;
|
ArgCommand = CommandId::MountVolume;
|
||||||
|
@ -50,7 +50,7 @@ namespace VeraCrypt
|
|||||||
struct CommandLineInterface
|
struct CommandLineInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CommandLineInterface (wxCmdLineParser &parser, UserInterfaceType::Enum interfaceType);
|
CommandLineInterface (int argc, wchar_t** argv, UserInterfaceType::Enum interfaceType);
|
||||||
virtual ~CommandLineInterface ();
|
virtual ~CommandLineInterface ();
|
||||||
|
|
||||||
|
|
||||||
|
@ -502,9 +502,7 @@ namespace VeraCrypt
|
|||||||
LangString.Init();
|
LangString.Init();
|
||||||
Core->Init();
|
Core->Init();
|
||||||
|
|
||||||
wxCmdLineParser parser;
|
CmdLine.reset (new CommandLineInterface (argc, argv, InterfaceType));
|
||||||
parser.SetCmdLine (argc, argv);
|
|
||||||
CmdLine.reset (new CommandLineInterface (parser, InterfaceType));
|
|
||||||
SetPreferences (CmdLine->Preferences);
|
SetPreferences (CmdLine->Preferences);
|
||||||
|
|
||||||
Core->SetApplicationExecutablePath (Application::GetExecutablePath());
|
Core->SetApplicationExecutablePath (Application::GetExecutablePath());
|
||||||
|
Loading…
Reference in New Issue
Block a user