Add drop_and_recreate in privatefile class.

When creating a private file we need to delete the file if exist.
This commit is contained in:
0xFFFC0000 2024-04-22 14:32:12 +00:00
parent c8214782fb
commit 267e31f5b7
No known key found for this signature in database
GPG key ID: 650F7C2B7BDA3819
3 changed files with 26 additions and 5 deletions

View file

@ -80,7 +80,11 @@ namespace tools
/*! \return File only readable by owner and only used by this process
OR `private_file{}` on error. */
static private_file create(std::string filename);
static private_file create(std::string filename, uint32_t extra_flags = 0);
/*! \return Drop and create file only readable by owner and only used
by this process OR `private_file{}` on error. */
static private_file drop_and_recreate(std::string filename);
private_file(private_file&&) = default;
private_file& operator=(private_file&&) = default;