2015-09-29 14:29:10 +02:00
|
|
|
#include "ProgramOptions.h"
|
|
|
|
#include <cstring>
|
2016-02-11 16:39:42 +01:00
|
|
|
#include <cpp-utils/assert/assert.h>
|
2019-01-19 22:02:41 +01:00
|
|
|
#include <cpp-utils/system/path.h>
|
2015-09-29 14:29:10 +02:00
|
|
|
|
2019-01-19 22:02:41 +01:00
|
|
|
using namespace cryfs_cli::program_options;
|
2015-09-29 14:29:10 +02:00
|
|
|
using std::string;
|
|
|
|
using std::vector;
|
2015-10-17 18:31:17 +02:00
|
|
|
using boost::optional;
|
2015-11-17 10:49:35 +01:00
|
|
|
namespace bf = boost::filesystem;
|
2015-09-29 14:29:10 +02:00
|
|
|
|
2022-06-18 21:11:24 +02:00
|
|
|
ProgramOptions::ProgramOptions(bf::path baseDir, optional<bf::path> configFile,
|
|
|
|
boost::filesystem::path localStateDir,
|
2022-06-25 16:57:50 +02:00
|
|
|
bool allowFilesystemUpgrade, bool allowReplacedFilesystem,
|
2022-06-18 21:11:24 +02:00
|
|
|
bool createMissingBasedir,
|
|
|
|
optional<string> cipher,
|
2017-10-01 10:04:29 +02:00
|
|
|
optional<uint32_t> blocksizeBytes,
|
2018-04-29 22:41:21 +02:00
|
|
|
bool allowIntegrityViolations,
|
2022-06-18 21:11:24 +02:00
|
|
|
boost::optional<bool> missingBlockIsIntegrityViolation)
|
|
|
|
: _baseDir(bf::absolute(std::move(baseDir))), _configFile(std::move(configFile)),
|
|
|
|
_localStateDir(std::move(localStateDir)),
|
2020-08-01 03:08:19 +02:00
|
|
|
_allowFilesystemUpgrade(allowFilesystemUpgrade), _allowReplacedFilesystem(allowReplacedFilesystem),
|
2022-06-18 21:11:24 +02:00
|
|
|
_createMissingBasedir(createMissingBasedir),
|
2020-08-01 03:08:19 +02:00
|
|
|
_cipher(std::move(cipher)), _blocksizeBytes(std::move(blocksizeBytes)),
|
|
|
|
_allowIntegrityViolations(allowIntegrityViolations),
|
2022-06-18 21:11:24 +02:00
|
|
|
_missingBlockIsIntegrityViolation(std::move(missingBlockIsIntegrityViolation)) {
|
2015-09-29 14:29:10 +02:00
|
|
|
}
|
|
|
|
|
2015-11-17 10:49:35 +01:00
|
|
|
const bf::path &ProgramOptions::baseDir() const {
|
2015-09-29 14:29:10 +02:00
|
|
|
return _baseDir;
|
|
|
|
}
|
|
|
|
|
2015-11-17 10:49:35 +01:00
|
|
|
const optional<bf::path> &ProgramOptions::configFile() const {
|
2015-09-29 14:39:10 +02:00
|
|
|
return _configFile;
|
|
|
|
}
|
|
|
|
|
2022-06-18 21:11:24 +02:00
|
|
|
const bf::path &ProgramOptions::localStateDir() const {
|
|
|
|
return _localStateDir;
|
2015-10-15 03:38:44 +02:00
|
|
|
}
|
|
|
|
|
2018-02-01 11:04:59 +01:00
|
|
|
bool ProgramOptions::allowFilesystemUpgrade() const {
|
|
|
|
return _allowFilesystemUpgrade;
|
|
|
|
}
|
|
|
|
|
2020-08-01 03:08:19 +02:00
|
|
|
bool ProgramOptions::createMissingBasedir() const {
|
|
|
|
return _createMissingBasedir;
|
|
|
|
}
|
|
|
|
|
2015-10-30 19:53:15 +01:00
|
|
|
const optional<string> &ProgramOptions::cipher() const {
|
|
|
|
return _cipher;
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:12:41 +01:00
|
|
|
const optional<uint32_t> &ProgramOptions::blocksizeBytes() const {
|
|
|
|
return _blocksizeBytes;
|
|
|
|
}
|
|
|
|
|
2018-04-29 22:41:21 +02:00
|
|
|
bool ProgramOptions::allowIntegrityViolations() const {
|
|
|
|
return _allowIntegrityViolations;
|
2017-09-16 17:18:04 +02:00
|
|
|
}
|
|
|
|
|
2018-02-03 17:33:59 +01:00
|
|
|
bool ProgramOptions::allowReplacedFilesystem() const {
|
|
|
|
return _allowReplacedFilesystem;
|
|
|
|
}
|
|
|
|
|
2016-06-27 07:07:58 +02:00
|
|
|
const optional<bool> &ProgramOptions::missingBlockIsIntegrityViolation() const {
|
|
|
|
return _missingBlockIsIntegrityViolation;
|
|
|
|
}
|