test_persist_files.cxx
Go to the documentation of this file.
1 #include "WireCellUtil/Persist.h"
2 #include "WireCellUtil/Testing.h"
3 
4 #include <cstdlib>
5 #include <string>
6 #include <iostream>
7 
8 using namespace WireCell;
9 
10 
11 
12 int main()
13 {
14  Assert(Persist::exists("/etc"));
15  Assert(Persist::exists("/etc/hosts"));
16 
17  setenv("WIRECELL_PATH", "/etc:/usr:/var", 1);
18  std::string etchosts = Persist::resolve("hosts");
19  //std::cerr << etchosts << std::endl;
20  Assert(etchosts == "/etc/hosts");
21 
22  std::string dne = Persist::resolve("this_file-really_should-not_exist");
23  Assert(dne.empty());
24 
25  return 0;
26 }
std::string string
Definition: nybbler.cc:12
#define Assert
Definition: Testing.h:7
bool exists(const std::string &filename)
Return true file exists (no file resolution performed).
Definition: Persist.cxx:79
Definition: Main.h:22
int main()
std::string resolve(const std::string &filename)
Definition: Persist.cxx:99