-------------------------------------------------------------------------
| 30 | { |
| 31 | //------------------------------------------------------------------------- |
| 32 | TemporaryPath::TemporaryPath(TemporaryPathOption temporaryPathOption) |
| 33 | { |
| 34 | auto now = std::chrono::system_clock::now().time_since_epoch(); |
| 35 | auto seed = static_cast<unsigned int>(now.count()); |
| 36 | std::default_random_engine generator(seed); |
| 37 | std::uniform_int_distribution<int> distribution; |
| 38 | auto temp_directory = fs::temp_directory_path(); |
| 39 | |
| 40 | do |
| 41 | { |
| 42 | path_ = fs::absolute(temp_directory / std::to_string(distribution(generator))); |
| 43 | } while (Tools::FileExists(path_)); |
| 44 | |
| 45 | if (temporaryPathOption == TemporaryPathOption::CreateAsFolder) |
| 46 | fs::create_directories(path_); |
| 47 | else if (temporaryPathOption == TemporaryPathOption::CreateAsFile) |
| 48 | CreateEmptyFile(path_); |
| 49 | } |
| 50 | |
| 51 | //------------------------------------------------------------------------- |
| 52 | TemporaryPath::~TemporaryPath() |
nothing calls this directly
no test coverage detected