rexglue-skate3/include/rex/filesystem/devices/host_path_entry.h
2026-05-18 22:41:13 +01:00

58 lines
2.1 KiB
C++

/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2020 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*
* @modified Tom Clay, 2026 - Adapted for ReXGlue runtime
*/
#pragma once
#include <string>
#include <rex/filesystem.h>
#include <rex/filesystem/entry.h>
namespace rex::filesystem {
class HostPathDevice;
class HostPathEntry : public Entry {
public:
HostPathEntry(Device* device, Entry* parent, const std::string_view path,
const std::filesystem::path& host_path);
~HostPathEntry() override;
static HostPathEntry* Create(Device* device, Entry* parent,
const std::filesystem::path& full_path,
rex::filesystem::FileInfo file_info);
const std::filesystem::path& host_path() const { return host_path_; }
X_STATUS Open(uint32_t desired_access, File** out_file) override;
bool Truncate() override;
bool can_map() const override { return true; }
std::unique_ptr<memory::MappedMemory> OpenMapped(memory::MappedMemory::Mode mode, size_t offset,
size_t length) override;
void update() override;
bool SetAttributes(uint64_t attributes) override;
bool SetCreateTimestamp(uint64_t timestamp) override;
bool SetAccessTimestamp(uint64_t timestamp) override;
bool SetWriteTimestamp(uint64_t timestamp) override;
private:
friend class HostPathDevice;
std::unique_ptr<Entry> CreateEntryInternal(const std::string_view name,
uint32_t attributes) override;
bool DeleteEntryInternal(Entry* entry) override;
void RenameEntryInternal(const std::vector<std::string_view>& path_parts) override;
std::filesystem::path host_path_;
};
} // namespace rex::filesystem