mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Fixed the bug to get file size
PiperOrigin-RevId: 597266370
This commit is contained in:
committed by
Copybara-Service
parent
c2ade33c9c
commit
e1f7044f28
@@ -42,6 +42,13 @@ IOFile::IOFile(const absl::string_view file_path, size_t size)
|
||||
file_.open(wide_path, std::ios::binary | std::ios::in | std::ios::ate);
|
||||
|
||||
total_size_ = file_.tellg();
|
||||
if (total_size_ == -1) {
|
||||
// Unsure why it consistently returns -1 when the file size exceeds 2GB. If
|
||||
// obtaining the file size through tellg fails, use the size provided
|
||||
// in the parameters.
|
||||
total_size_ = size;
|
||||
}
|
||||
|
||||
file_.seekg(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user