27#ifndef SPTK_ARCHIVEFILE_H
28#define SPTK_ARCHIVEFILE_H
30#include <sptk5/Buffer.h>
31#include <sptk5/DateTime.h>
35constexpr int TAR_BLOCK_SIZE = 512;
43 std::array<char, 100> filename;
44 std::array<char, 8> mode;
45 std::array<char, 8> uid;
46 std::array<char, 8> gid;
47 std::array<char, 12> size;
48 std::array<char, 12> mtime;
49 std::array<char, 8> chksum;
51 std::array<char, 100> linkname;
52 std::array<char, 6> magic;
53 std::array<char, 2> version;
54 std::array<char, 32> uname;
55 std::array<char, 32> gname;
56 std::array<char, 8> devmajor;
57 std::array<char, 8> devminor;
58 std::array<char, 155> prefix;
59 std::array<char, 12> padding;
99 explicit ArchiveFile(
const fs::path& fileName,
const fs::path& baseDirectory);
125 unsigned mode()
const
130 const Ownership& ownership()
const
135 unsigned size()
const
140 DateTime mtime()
const
150 String linkname()
const
155 static fs::path relativePath(
const fs::path& fileName,
const fs::path& baseDirectory);
159 unsigned m_mode {777};
160 Ownership m_ownership {};
163 Type m_type {Type::REGULAR_FILE};
166 std::shared_ptr<TarHeader> m_header;
171using SArchiveFile = std::shared_ptr<ArchiveFile>;
File inside tar archive.
Definition: ArchiveFile.h:69
Type
File type for file inside tar archive.
Definition: ArchiveFile.h:75
const char * header() const
Actual tar file header, length is TAR_BLOCK_SIZE.
ArchiveFile(const fs::path &fileName, const fs::path &baseDirectory)
Constructor.
ArchiveFile(const fs::path &fileName, const Buffer &content, int mode, const DateTime &mtime, ArchiveFile::Type type, const Ownership &ownership, const fs::path &linkName)
Constructor.
Definition: DateTime.h:86
Definition: ArchiveFile.h:87