libcruft-util/cruft/util/fs/tmp.hpp

36 lines
1.2 KiB
C++
Raw Permalink Normal View History

2022-01-19 12:01:16 +11:00
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2022, Danny Robson <danny@nerdcruft.net>
*/
#pragma once
#include <filesystem>
namespace cruft::fs {
2022-05-27 13:20:02 +10:00
/// Create a temporary file and return the path to the a newly
/// created file (in a system appropriate location).
///
/// It is the caller's responsibility to clean up this file if
/// required.
///
/// No guarantees are made about the longevity of the file after
/// the application terminates.
std::filesystem::path mktempfile [[nodiscard]] (void);
std::filesystem::path mktempfile [[nodiscard]] (std::filesystem::path const &dir);
2022-01-19 12:01:16 +11:00
/// Create a temporary directory and return the path to the a newly
/// created directory (in a system appropriate location).
///
/// It is the caller's responsibility to clean up this directory if
/// required.
///
/// No guarantees are made about the longevity of the directory after
/// the application terminates.
std::filesystem::path mktmpdir [[nodiscard]] (void);
}