diff options
Diffstat (limited to 'lib/Support/Unix/PathV2.inc')
-rw-r--r-- | lib/Support/Unix/PathV2.inc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Support/Unix/PathV2.inc b/lib/Support/Unix/PathV2.inc index 8ecf2a4222..75cfce822a 100644 --- a/lib/Support/Unix/PathV2.inc +++ b/lib/Support/Unix/PathV2.inc @@ -213,6 +213,16 @@ error_code rename(const Twine &from, const Twine &to) { return make_error_code(errc::success); } +error_code resize_file(const Twine &path, uint64_t size) { + SmallString<128> path_storage; + StringRef p = path.toNullTerminatedStringRef(path_storage); + + if (::truncate(p.begin(), size) == -1) + return error_code(errno, system_category()); + + return make_error_code(errc::success); +} + error_code exists(const Twine &path, bool &result) { SmallString<128> path_storage; StringRef p = path.toNullTerminatedStringRef(path_storage); |