sys: Updated to use the new HttpRequest helper instead of Net

This commit is contained in:
WerWolv
2023-03-23 11:23:07 +01:00
parent e7e2af9f91
commit 15be24db62
32 changed files with 274 additions and 562 deletions

View File

@@ -84,7 +84,7 @@ namespace hex {
this->m_valid = false;
}
std::vector<u8> Tar::read(const std::fs::path &path) {
std::vector<u8> Tar::readVector(const std::fs::path &path) {
mtar_header_t header;
auto fixedPath = path.string();
@@ -100,11 +100,11 @@ namespace hex {
}
std::string Tar::readString(const std::fs::path &path) {
auto result = this->read(path);
auto result = this->readVector(path);
return { result.begin(), result.end() };
}
void Tar::write(const std::fs::path &path, const std::vector<u8> &data) {
void Tar::writeVector(const std::fs::path &path, const std::vector<u8> &data) {
if (path.has_parent_path()) {
std::fs::path pathPart;
for (const auto &part : path.parent_path()) {
@@ -126,8 +126,8 @@ namespace hex {
mtar_write_data(&this->m_ctx, data.data(), data.size());
}
void Tar::write(const std::fs::path &path, const std::string &data) {
this->write(path, std::vector<u8>(data.begin(), data.end()));
void Tar::writeString(const std::fs::path &path, const std::string &data) {
this->writeVector(path, { data.begin(), data.end() });
}
static void writeFile(mtar_t *ctx, mtar_header_t *header, const std::fs::path &path) {
@@ -140,7 +140,7 @@ namespace hex {
buffer.resize(std::min<u64>(BufferSize, header->size - offset));
mtar_read_data(ctx, buffer.data(), buffer.size());
outputFile.write(buffer);
outputFile.writeVector(buffer);
}
}