Directory: | cvmfs/ |
---|---|
File: | cvmfs/util/raii_temp_dir.cc |
Date: | 2025-02-09 02:34:19 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 7 | 9 | 77.8% |
Branches: | 3 | 8 | 37.5% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /** | ||
2 | * This file is part of the CernVM File System. | ||
3 | */ | ||
4 | |||
5 | #include "raii_temp_dir.h" | ||
6 | |||
7 | #include "util/posix.h" | ||
8 | |||
9 | 8 | RaiiTempDir* RaiiTempDir::Create(const std::string& prefix) { | |
10 |
1/2✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | RaiiTempDir* tmp = new RaiiTempDir(prefix); |
11 |
2/4✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
|
8 | if (tmp->dir() != "") { |
12 | 8 | return tmp; | |
13 | } else { | ||
14 | ✗ | delete tmp; | |
15 | ✗ | return NULL; | |
16 | } | ||
17 | } | ||
18 | |||
19 | 8 | RaiiTempDir::RaiiTempDir(const std::string& prefix) | |
20 | 8 | : dir_(CreateTempDir(prefix)) {} | |
21 | |||
22 | 8 | RaiiTempDir::~RaiiTempDir() { RemoveTree(dir_); } | |
23 |