blob: 502fcf0afe7b131ae10d43e15ec370360ba35b9c [file] [log] [blame]
Matt Spinlerdf13bdb2019-07-10 16:54:13 -05001#include "extensions/openpower-pels/paths.hpp"
2
3#include <filesystem>
4
5namespace openpower
6{
7namespace pels
8{
9
10// Use paths that work in unit tests.
11
12std::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 Spinler89fa0822019-07-17 13:54:30 -050025std::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 Spinler367144c2019-09-19 15:33:52 -050038std::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 Spinlerdf13bdb2019-07-10 16:54:13 -050051} // namespace pels
52} // namespace openpower