Matt Spinler | df13bdb | 2019-07-10 16:54:13 -0500 | [diff] [blame] | 1 | #include "extensions/openpower-pels/paths.hpp" |
| 2 | |
| 3 | #include <filesystem> |
| 4 | |
| 5 | namespace openpower |
| 6 | { |
| 7 | namespace pels |
| 8 | { |
| 9 | |
| 10 | // Use paths that work in unit tests. |
| 11 | |
| 12 | std::filesystem::path getPELIDFile() |
| 13 | { |
| 14 | static std::string idFile; |
| 15 | |
| 16 | if (idFile.empty()) |
| 17 | { |
| 18 | char templ[] = "/tmp/logidtestXXXXXX"; |
| 19 | std::filesystem::path dir = mkdtemp(templ); |
| 20 | idFile = dir / "logid"; |
| 21 | } |
| 22 | return idFile; |
| 23 | } |
| 24 | |
Matt Spinler | 89fa082 | 2019-07-17 13:54:30 -0500 | [diff] [blame] | 25 | std::filesystem::path getPELRepoPath() |
| 26 | { |
| 27 | static std::string repoPath; |
| 28 | |
| 29 | if (repoPath.empty()) |
| 30 | { |
| 31 | char templ[] = "/tmp/repopathtestXXXXXX"; |
| 32 | std::filesystem::path dir = mkdtemp(templ); |
| 33 | repoPath = dir; |
| 34 | } |
| 35 | return repoPath; |
| 36 | } |
| 37 | |
Matt Spinler | df13bdb | 2019-07-10 16:54:13 -0500 | [diff] [blame] | 38 | } // namespace pels |
| 39 | } // namespace openpower |