From 002dc6ca17e4a7b72b9ba98c5d92f89245743de1 Mon Sep 17 00:00:00 2001 From: Francis Banyikwa Date: Wed, 1 Jun 2016 13:37:44 +0300 Subject: [PATCH] solve issue number 24 --- src/cryfs-cli/program_options/ProgramOptions.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/cryfs-cli/program_options/ProgramOptions.cpp b/src/cryfs-cli/program_options/ProgramOptions.cpp index 83d7cd84..dc8466d7 100644 --- a/src/cryfs-cli/program_options/ProgramOptions.cpp +++ b/src/cryfs-cli/program_options/ProgramOptions.cpp @@ -16,6 +16,20 @@ ProgramOptions::ProgramOptions(const bf::path &baseDir, const bf::path &mountDir :_baseDir(baseDir), _mountDir(mountDir), _configFile(configFile), _foreground(foreground), _cipher(cipher), _blocksizeBytes(blocksizeBytes), _unmountAfterIdleMinutes(unmountAfterIdleMinutes), _logFile(logFile), _fuseOptions(fuseOptions) { + + auto hasNoOption = [&](const char *opt) { + for (const string& it : _fuseOptions) { + if (std::strncmp(it.c_str(), opt, std::strlen(opt))) { + return false; + } + } + return true; + }; + + if (hasNoOption("subtype=cryfs") && hasNoOption("fsname=cryfs@")) { + _fuseOptions.push_back("-ofsname=cryfs@"+baseDir.native()); + _fuseOptions.push_back("-osubtype=cryfs"); + } } const bf::path &ProgramOptions::baseDir() const {