diff options
| author | Zach Hilman <zachhilman@gmail.com> | 2018-07-27 23:55:23 -0400 |
|---|---|---|
| committer | Zach Hilman <zachhilman@gmail.com> | 2018-08-01 00:16:54 -0400 |
| commit | df5b75694f5abde94ccf05fa6c7a557b1ba9079b (patch) | |
| tree | 70f0cf96b1a9834360fb1c5d5547939693ecd577 /src/core/file_sys/vfs.cpp | |
| parent | d2ad279a32751756c6c7bcb9354136f52dea0795 (diff) | |
Remove files that are not used
Diffstat (limited to 'src/core/file_sys/vfs.cpp')
| -rw-r--r-- | src/core/file_sys/vfs.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp index 84a6a7397..57d0aeb85 100644 --- a/src/core/file_sys/vfs.cpp +++ b/src/core/file_sys/vfs.cpp @@ -285,6 +285,27 @@ bool ReadOnlyVfsDirectory::Rename(std::string_view name) { return false; } +bool DeepEquals(const VirtualFile& file1, const VirtualFile& file2, size_t block_size) { + if (file1->GetSize() != file2->GetSize()) + return false; + + std::vector<u8> f1_v(block_size); + std::vector<u8> f2_v(block_size); + for (size_t i = 0; i < file1->GetSize(); i += block_size) { + auto f1_vs = file1->Read(f1_v.data(), block_size, i); + auto f2_vs = file2->Read(f2_v.data(), block_size, i); + + if (f1_vs != f2_vs) + return false; + for (size_t j = 0; j < f1_vs; ++j) { + if (f1_v[j] != f2_v[j]) + return false; + } + } + + return true; +} + bool VfsRawCopy(VirtualFile src, VirtualFile dest) { if (src == nullptr || dest == nullptr) return false; |
