[Kernel] Added Support For: XFileRenameInformation

This commit is contained in:
Gliniak
2024-01-29 22:03:58 +01:00
parent 8b14b4bbc4
commit 74b52711a3
11 changed files with 134 additions and 64 deletions

View File

@@ -40,6 +40,10 @@ class HostPathDevice : public Device {
uint32_t sectors_per_allocation_unit() const override { return 1; }
uint32_t bytes_per_sector() const override { return 0x200; }
protected:
friend class HostPathEntry;
std::filesystem::path host_path() const { return host_path_; }
private:
void PopulateEntry(HostPathEntry* parent_entry);

View File

@@ -15,6 +15,7 @@
#include "xenia/base/math.h"
#include "xenia/base/string.h"
#include "xenia/vfs/device.h"
#include "xenia/vfs/devices/host_path_device.h"
#include "xenia/vfs/devices/host_path_file.h"
namespace xe {
@@ -110,6 +111,15 @@ bool HostPathEntry::DeleteEntryInternal(Entry* entry) {
}
}
void HostPathEntry::RenameEntryInternal(const std::filesystem::path file_path) {
const std::string new_host_path_ = xe::utf8::join_paths(
xe::path_to_utf8(((HostPathDevice*)device_)->host_path()),
xe::path_to_utf8(file_path));
std::filesystem::rename(host_path_, new_host_path_);
host_path_ = new_host_path_;
}
void HostPathEntry::update() {
xe::filesystem::FileInfo file_info;
if (!xe::filesystem::GetInfo(host_path_, &file_info)) {

View File

@@ -46,6 +46,7 @@ class HostPathEntry : public Entry {
std::unique_ptr<Entry> CreateEntryInternal(const std::string_view name,
uint32_t attributes) override;
bool DeleteEntryInternal(Entry* entry) override;
void RenameEntryInternal(const std::filesystem::path file_path) override;
std::filesystem::path host_path_;
};