aboutsummaryrefslogtreecommitdiff
path: root/src/util/system.cpp
diff options
context:
space:
mode:
authorSjors Provoost <sjors@sprovoost.nl>2020-03-20 11:41:11 +0100
committerSjors Provoost <sjors@sprovoost.nl>2020-03-24 20:29:49 +0100
commit86e22d23bb90383971a68ead0666f225ddd632fb (patch)
treeb873b47e7ae092584765278fa8320b2b2ac2728b /src/util/system.cpp
parent6ab3aad9a51cc5e97a8e2ae7dbd5082272163c30 (diff)
[util] GetFileSize
Diffstat (limited to 'src/util/system.cpp')
-rw-r--r--src/util/system.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp
index b0a538b527..5921378a76 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -141,6 +141,12 @@ bool CheckDiskSpace(const fs::path& dir, uint64_t additional_bytes)
return free_bytes_available >= min_disk_space + additional_bytes;
}
+std::streampos GetFileSize(const char* path, std::streamsize max) {
+ std::ifstream file(path, std::ios::binary);
+ file.ignore(max);
+ return file.gcount();
+}
+
/**
* Interpret a string argument as a boolean.
*