libcryfs/src/CrySymlink.cpp

49 lines
1014 B
C++
Raw Normal View History

2015-04-23 09:18:30 +02:00
#include "CrySymlink.h"
#include "messmer/fspp/fuse/FuseErrnoException.h"
#include "CryDevice.h"
#include "CrySymlink.h"
#include "impl/SymlinkBlob.h"
//TODO Get rid of this in favor of exception hierarchy
using fspp::fuse::CHECK_RETVAL;
using fspp::fuse::FuseErrnoException;
namespace bf = boost::filesystem;
using std::unique_ptr;
using std::make_unique;
using std::string;
using std::vector;
using blockstore::Key;
using boost::none;
using cpputils::unique_ref;
2015-04-23 09:18:30 +02:00
namespace cryfs {
CrySymlink::CrySymlink(CryDevice *device, unique_ref<DirBlob> parent, const Key &key)
2015-04-23 09:18:30 +02:00
: CryNode(device, std::move(parent), key) {
}
CrySymlink::~CrySymlink() {
}
unique_ptr<SymlinkBlob> CrySymlink::LoadBlob() const {
auto blob = CryNode::LoadBlob();
if (blob == none) {
return nullptr;
}
return make_unique<SymlinkBlob>(std::move(*blob));
2015-04-23 09:18:30 +02:00
}
fspp::Dir::EntryType CrySymlink::getType() const {
return fspp::Dir::EntryType::SYMLINK;
}
bf::path CrySymlink::target() const {
return LoadBlob()->target();
}
}