diff options
| author | 2021-07-05 12:05:35 -0400 | |
|---|---|---|
| committer | 2021-07-06 05:59:47 -0400 | |
| commit | d299d5531ff234d4a9c986126b872aac4ffc4dd8 (patch) | |
| tree | b8a9406f3ee8a7e8b0771223e5e99b4bb43b6cef /src/common/fs | |
| parent | Merge pull request #6537 from Morph1984/warnings (diff) | |
| download | yuzu-d299d5531ff234d4a9c986126b872aac4ffc4dd8.tar.gz yuzu-d299d5531ff234d4a9c986126b872aac4ffc4dd8.tar.xz yuzu-d299d5531ff234d4a9c986126b872aac4ffc4dd8.zip | |
common: fs: file: Flush the file in GetSize
This ensures that GetSize always retrieves the correct file size after a write operation.
Diffstat (limited to 'src/common/fs')
| -rw-r--r-- | src/common/fs/file.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/fs/file.cpp b/src/common/fs/file.cpp index 077f34995..022780e4e 100644 --- a/src/common/fs/file.cpp +++ b/src/common/fs/file.cpp | |||
| @@ -347,6 +347,9 @@ u64 IOFile::GetSize() const { | |||
| 347 | return 0; | 347 | return 0; |
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | // Flush any unwritten buffered data into the file prior to retrieving the file size. | ||
| 351 | std::fflush(file); | ||
| 352 | |||
| 350 | std::error_code ec; | 353 | std::error_code ec; |
| 351 | 354 | ||
| 352 | const auto file_size = fs::file_size(file_path, ec); | 355 | const auto file_size = fs::file_size(file_path, ec); |