summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/partition_filesystem.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-07-21 04:14:59 +0200
committerLioncash <mathew1800@gmail.com>2018-07-21 04:19:17 +0200
commit2b91386e155ba9a9e8c06d7c90fe9710aecf8076 (patch)
tree7049ac97bcecb70425abdcf53b1bce419cdf5bb0 /src/core/file_sys/partition_filesystem.cpp
parentMerge pull request #743 from lioncash/view (diff)
downloadyuzu-2b91386e155ba9a9e8c06d7c90fe9710aecf8076.tar
yuzu-2b91386e155ba9a9e8c06d7c90fe9710aecf8076.tar.gz
yuzu-2b91386e155ba9a9e8c06d7c90fe9710aecf8076.tar.bz2
yuzu-2b91386e155ba9a9e8c06d7c90fe9710aecf8076.tar.lz
yuzu-2b91386e155ba9a9e8c06d7c90fe9710aecf8076.tar.xz
yuzu-2b91386e155ba9a9e8c06d7c90fe9710aecf8076.tar.zst
yuzu-2b91386e155ba9a9e8c06d7c90fe9710aecf8076.zip
Diffstat (limited to 'src/core/file_sys/partition_filesystem.cpp')
-rw-r--r--src/core/file_sys/partition_filesystem.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/file_sys/partition_filesystem.cpp b/src/core/file_sys/partition_filesystem.cpp
index 7ccca1089..fc37a40cc 100644
--- a/src/core/file_sys/partition_filesystem.cpp
+++ b/src/core/file_sys/partition_filesystem.cpp
@@ -2,7 +2,9 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <iterator>
#include <utility>
+
#include "common/file_util.h"
#include "common/logging/log.h"
#include "core/file_sys/partition_filesystem.h"
@@ -99,11 +101,12 @@ void PartitionFilesystem::PrintDebugInfo() const {
}
bool PartitionFilesystem::ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) {
- auto iter = std::find(pfs_files.begin(), pfs_files.end(), file);
+ const auto iter = std::find(pfs_files.begin(), pfs_files.end(), file);
if (iter == pfs_files.end())
return false;
- pfs_files[iter - pfs_files.begin()] = pfs_files.back();
+ const std::ptrdiff_t offset = std::distance(pfs_files.begin(), iter);
+ pfs_files[offset] = pfs_files.back();
pfs_files.pop_back();
pfs_dirs.emplace_back(dir);