Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ set(ODR_SOURCE_FILES
"src/odr/internal/text/text_util.cpp"

"src/odr/internal/util/byte_util.cpp"
"src/odr/internal/util/byte_stream_util.cpp"
"src/odr/internal/util/document_util.cpp"
"src/odr/internal/util/file_util.cpp"
"src/odr/internal/util/hash_util.cpp"
Expand Down
7 changes: 5 additions & 2 deletions src/odr/internal/cfb/cfb_archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ CfbArchive::CfbArchive(std::shared_ptr<util::Archive> archive)
: m_cfb{std::move(archive)} {}

std::shared_ptr<abstract::Filesystem> CfbArchive::as_filesystem() const {
// TODO return an actual filesystem view
auto filesystem = std::make_shared<VirtualFilesystem>();

for (const auto &e : *m_cfb) {
const AbsPath path = Path(e.path()).make_absolute();

if (e.is_directory()) {
filesystem->create_directory(e.path());
filesystem->create_directory(path);
} else if (e.is_file()) {
filesystem->copy(e.file(), e.path());
filesystem->copy(e.file(), path);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/odr/internal/cfb/cfb_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

namespace odr::internal::cfb {

CfbFile::CfbFile(const std::shared_ptr<MemoryFile> &file)
: m_cfb{std::make_shared<util::Archive>(file)} {}
CfbFile::CfbFile(std::shared_ptr<abstract::File> file)
: m_cfb{std::make_shared<util::Archive>(std::move(file))} {}

std::shared_ptr<abstract::File> CfbFile::file() const noexcept {
return m_cfb->file();
Expand Down
6 changes: 1 addition & 5 deletions src/odr/internal/cfb/cfb_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ enum class FileType;
struct FileMeta;
} // namespace odr

namespace odr::internal {
class MemoryFile;
} // namespace odr::internal

namespace odr::internal::cfb::util {
class Archive;
}
Expand All @@ -19,7 +15,7 @@ namespace odr::internal::cfb {

class CfbFile final : public abstract::ArchiveFile {
public:
explicit CfbFile(const std::shared_ptr<MemoryFile> &file);
explicit CfbFile(std::shared_ptr<abstract::File> file);

[[nodiscard]] std::shared_ptr<abstract::File> file() const noexcept override;

Expand Down
Loading
Loading