2019-01-19 22:02:41 +01:00
|
|
|
#include "ProgramOptions.h"
|
|
|
|
#include <cstring>
|
|
|
|
#include <cpp-utils/assert/assert.h>
|
|
|
|
#include <cpp-utils/system/path.h>
|
|
|
|
|
|
|
|
using namespace cryfs_unmount::program_options;
|
|
|
|
using std::string;
|
|
|
|
namespace bf = boost::filesystem;
|
|
|
|
|
2020-07-11 02:30:07 +02:00
|
|
|
ProgramOptions::ProgramOptions(bf::path mountDir, bool immediate)
|
|
|
|
: _mountDir(std::move(mountDir)),
|
|
|
|
_mountDirIsDriveLetter(cpputils::path_is_just_drive_letter(_mountDir)),
|
|
|
|
_immediate(immediate)
|
2019-01-19 22:02:41 +01:00
|
|
|
{
|
2020-07-11 02:30:07 +02:00
|
|
|
if (!_mountDirIsDriveLetter)
|
|
|
|
{
|
2019-01-19 22:02:41 +01:00
|
|
|
_mountDir = bf::absolute(std::move(_mountDir));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-11 02:30:07 +02:00
|
|
|
const bf::path &ProgramOptions::mountDir() const
|
|
|
|
{
|
2019-01-19 22:02:41 +01:00
|
|
|
return _mountDir;
|
|
|
|
}
|
|
|
|
|
2020-07-11 02:30:07 +02:00
|
|
|
bool ProgramOptions::mountDirIsDriveLetter() const
|
|
|
|
{
|
2019-01-19 22:02:41 +01:00
|
|
|
return _mountDirIsDriveLetter;
|
|
|
|
}
|
2020-07-11 02:30:07 +02:00
|
|
|
|
|
|
|
bool ProgramOptions::immediate() const
|
|
|
|
{
|
|
|
|
return _immediate;
|
|
|
|
}
|