Changeset View
Changeset View
Standalone View
Standalone View
src/util.cpp
Show First 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | bool DirIsWritable(const fs::path &directory) { | ||||
} | } | ||||
fclose(file); | fclose(file); | ||||
remove(tmpFile); | remove(tmpFile); | ||||
return true; | return true; | ||||
} | } | ||||
bool CheckDiskSpace(const fs::path &dir, uint64_t nAdditionalBytes) { | bool CheckDiskSpace(const fs::path &dir, uint64_t additional_bytes) { | ||||
// 50 MiB | // 50 MiB | ||||
constexpr uint64_t nMinDiskSpace = 52428800; | constexpr uint64_t min_disk_space = 52428800; | ||||
uint64_t nFreeBytesAvailable = fs::space(dir).available; | uint64_t free_bytes_available = fs::space(dir).available; | ||||
return nFreeBytesAvailable >= nMinDiskSpace + nAdditionalBytes; | return free_bytes_available >= min_disk_space + additional_bytes; | ||||
} | } | ||||
/** | /** | ||||
* Interpret a string argument as a boolean. | * Interpret a string argument as a boolean. | ||||
* | * | ||||
* The definition of atoi() requires that non-numeric string values like "foo", | * The definition of atoi() requires that non-numeric string values like "foo", | ||||
* return 0. This means that if a user unintentionally supplies a non-integer | * return 0. This means that if a user unintentionally supplies a non-integer | ||||
* argument here, the return value is always false. This means that -foo=false | * argument here, the return value is always false. This means that -foo=false | ||||
▲ Show 20 Lines • Show All 1,098 Lines • Show Last 20 Lines |