diff options
author | Sjors Provoost <sjors@sprovoost.nl> | 2020-03-20 11:41:11 +0100 |
---|---|---|
committer | Sjors Provoost <sjors@sprovoost.nl> | 2020-03-24 20:29:49 +0100 |
commit | 86e22d23bb90383971a68ead0666f225ddd632fb (patch) | |
tree | b873b47e7ae092584765278fa8320b2b2ac2728b /src/util/system.h | |
parent | 6ab3aad9a51cc5e97a8e2ae7dbd5082272163c30 (diff) |
[util] GetFileSize
Diffstat (limited to 'src/util/system.h')
-rw-r--r-- | src/util/system.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util/system.h b/src/util/system.h index 3138522b5c..61fd611aca 100644 --- a/src/util/system.h +++ b/src/util/system.h @@ -63,6 +63,14 @@ void UnlockDirectory(const fs::path& directory, const std::string& lockfile_name bool DirIsWritable(const fs::path& directory); bool CheckDiskSpace(const fs::path& dir, uint64_t additional_bytes = 0); +/** Get the size of a file by scanning it. + * + * @param[in] path The file path + * @param[in] max Stop seeking beyond this limit + * @return The file size or max + */ +std::streampos GetFileSize(const char* path, std::streamsize max = std::numeric_limits<std::streamsize>::max()); + /** Release all directory locks. This is used for unit testing only, at runtime * the global destructor will take care of the locks. */ |