Directory: | cvmfs/ |
---|---|
File: | cvmfs/util/raii_temp_dir.cc |
Date: | 2025-06-29 02:35:41 |
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 | #include <string> | ||
7 | #include <cstddef> | ||
8 | |||
9 | #include "util/posix.h" | ||
10 | |||
11 | 104 | RaiiTempDir *RaiiTempDir::Create(const std::string &prefix) { | |
12 |
1/2✓ Branch 2 taken 104 times.
✗ Branch 3 not taken.
|
104 | RaiiTempDir *tmp = new RaiiTempDir(prefix); |
13 |
2/4✓ Branch 2 taken 104 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 104 times.
✗ Branch 6 not taken.
|
104 | if (tmp->dir() != "") { |
14 | 104 | return tmp; | |
15 | } else { | ||
16 | ✗ | delete tmp; | |
17 | ✗ | return NULL; | |
18 | } | ||
19 | } | ||
20 | |||
21 | 104 | RaiiTempDir::RaiiTempDir(const std::string &prefix) | |
22 | 104 | : dir_(CreateTempDir(prefix)) { } | |
23 | |||
24 | 104 | RaiiTempDir::~RaiiTempDir() { RemoveTree(dir_); } | |
25 |