diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc index 40dc70210..845320599 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_io_info.cc @@ -253,6 +253,7 @@ dword_result_t NtSetInformationFile_entry( // Used to set deletion flag. Which we don't support. Probably? auto info = info_ptr.as(); bool delete_on_close = info->delete_file ? true : false; + file->entry()->SetForDeletion(static_cast(info->delete_file)); out_length = 0; XELOGW("NtSetInformationFile ignoring delete on close: {}", delete_on_close); diff --git a/src/xenia/vfs/devices/host_path_file.cc b/src/xenia/vfs/devices/host_path_file.cc index fd7e9f6fa..b037d511f 100644 --- a/src/xenia/vfs/devices/host_path_file.cc +++ b/src/xenia/vfs/devices/host_path_file.cc @@ -21,7 +21,12 @@ HostPathFile::HostPathFile( HostPathFile::~HostPathFile() = default; -void HostPathFile::Destroy() { delete this; } +void HostPathFile::Destroy() { + if (entry_ && entry_->delete_on_close()) { + entry()->Delete(); + } + delete this; +} X_STATUS HostPathFile::ReadSync(void* buffer, size_t buffer_length, size_t byte_offset, size_t* out_bytes_read) { diff --git a/src/xenia/vfs/entry.cc b/src/xenia/vfs/entry.cc index 56a6b7def..da2a7b939 100644 --- a/src/xenia/vfs/entry.cc +++ b/src/xenia/vfs/entry.cc @@ -25,7 +25,8 @@ Entry::Entry(Device* device, Entry* parent, const std::string_view path) allocation_size_(0), create_timestamp_(0), access_timestamp_(0), - write_timestamp_(0) { + write_timestamp_(0), + delete_on_close_(false) { assert_not_null(device); absolute_path_ = xe::utf8::join_guest_paths(device->mount_path(), path); name_ = xe::utf8::find_name_from_guest_path(path); diff --git a/src/xenia/vfs/entry.h b/src/xenia/vfs/entry.h index 9832990ff..3b80c25cb 100644 --- a/src/xenia/vfs/entry.h +++ b/src/xenia/vfs/entry.h @@ -93,11 +93,15 @@ class Entry { uint64_t create_timestamp() const { return create_timestamp_; } uint64_t access_timestamp() const { return access_timestamp_; } uint64_t write_timestamp() const { return write_timestamp_; } + bool delete_on_close() const { return delete_on_close_; } virtual bool SetAttributes(uint64_t attributes) { return false; } virtual bool SetCreateTimestamp(uint64_t timestamp) { return false; } virtual bool SetAccessTimestamp(uint64_t timestamp) { return false; } virtual bool SetWriteTimestamp(uint64_t timestamp) { return false; } + void SetForDeletion(bool delete_on_close) { + delete_on_close_ = delete_on_close; + } bool is_read_only() const; @@ -151,6 +155,7 @@ class Entry { uint64_t create_timestamp_; uint64_t access_timestamp_; uint64_t write_timestamp_; + bool delete_on_close_; std::vector> children_; };