VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-03-08 20:08:16 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-03-08 20:14:30 +0100
commit279c99fdf829884b8a544441d0a2cd09e9c8dd27 (patch)
treee12410d6b8567d7bca1b15fc59b4dac106393e49 /src
parentf80f7d47d587710f657ab6f6c20140ddb503250e (diff)
downloadVeraCrypt-279c99fdf829884b8a544441d0a2cd09e9c8dd27.tar.gz
VeraCrypt-279c99fdf829884b8a544441d0a2cd09e9c8dd27.zip
Linux/MacOSX: Load preferences if only volume path is given in command line and GUI mode enabled.
Diffstat (limited to 'src')
-rw-r--r--src/Main/CommandLineInterface.cpp21
-rw-r--r--src/Main/CommandLineInterface.h2
-rw-r--r--src/Main/UserInterface.cpp6
3 files changed, 23 insertions, 6 deletions
diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp
index fd164474..82a99e7f 100644
--- a/src/Main/CommandLineInterface.cpp
+++ b/src/Main/CommandLineInterface.cpp
@@ -17,7 +17,7 @@
namespace VeraCrypt
{
- CommandLineInterface::CommandLineInterface (wxCmdLineParser &parser, UserInterfaceType::Enum interfaceType) :
+ CommandLineInterface::CommandLineInterface (int argc, wchar_t** argv, UserInterfaceType::Enum interfaceType) :
ArgCommand (CommandId::None),
ArgFilesystem (VolumeCreationOptions::FilesystemType::Unknown),
ArgNoHiddenVolumeProtection (false),
@@ -26,6 +26,9 @@ namespace VeraCrypt
ArgTrueCryptMode (false),
StartBackgroundTask (false)
{
+ wxCmdLineParser parser;
+ parser.SetCmdLine (argc, argv);
+
parser.SetSwitchChars (L"-");
parser.AddOption (L"", L"auto-mount", _("Auto mount device-hosted/favorite volumes"));
@@ -475,6 +478,22 @@ namespace VeraCrypt
// Parameters
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)
{
ArgCommand = CommandId::MountVolume;
diff --git a/src/Main/CommandLineInterface.h b/src/Main/CommandLineInterface.h
index c0d3f19f..217b5c39 100644
--- a/src/Main/CommandLineInterface.h
+++ b/src/Main/CommandLineInterface.h
@@ -50,7 +50,7 @@ namespace VeraCrypt
struct CommandLineInterface
{
public:
- CommandLineInterface (wxCmdLineParser &parser, UserInterfaceType::Enum interfaceType);
+ CommandLineInterface (int argc, wchar_t** argv, UserInterfaceType::Enum interfaceType);
virtual ~CommandLineInterface ();
diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp
index 39c4274f..9894a853 100644
--- a/src/Main/UserInterface.cpp
+++ b/src/Main/UserInterface.cpp
@@ -501,10 +501,8 @@ namespace VeraCrypt
LangString.Init();
Core->Init();
-
- wxCmdLineParser parser;
- parser.SetCmdLine (argc, argv);
- CmdLine.reset (new CommandLineInterface (parser, InterfaceType));
+
+ CmdLine.reset (new CommandLineInterface (argc, argv, InterfaceType));
SetPreferences (CmdLine->Preferences);
Core->SetApplicationExecutablePath (Application::GetExecutablePath());