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 | 367144c | 2019-09-19 15:33:52 -0500 | [diff] [blame] | 38 | std::filesystem::path getMessageRegistryPath() |
| 39 | { |
| 40 | static std::string registryPath; |
| 41 | |
| 42 | if (registryPath.empty()) |
| 43 | { |
| 44 | char templ[] = "/tmp/msgregtestXXXXXX"; |
| 45 | registryPath = mkdtemp(templ); |
| 46 | } |
| 47 | |
| 48 | return registryPath; |
| 49 | } |
| 50 | |
Matt Spinler | df13bdb | 2019-07-10 16:54:13 -0500 | [diff] [blame] | 51 | } // namespace pels |
| 52 | } // namespace openpower |