BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TPathResolver.cxx
Go to the documentation of this file.
1
3
4#include <cstdlib>
5#include <cstdio>
6#include <iostream>
7
8int main ()
9{
10 char b1[256];
11 //char b2[256];
12 //char b3[256];
13
14 sprintf (b1, "APATH=../test:../test/A:../test/B");
15
16 ::putenv (b1);
17
18 const char* env_ptr = ::getenv ("APATH");
19 if (env_ptr != 0)
20 {
21 std::string env = env_ptr;
22
23 std::cout << "APATH=" << env << std::endl;
24 }
25
26 std::string name;
27
28 name = PathResolverFindFile ("a.txt", "APATH");
29 std::cout << "1) [a.txt] Name = " << name << " [expected : ../test/A/a.txt]" << std::endl;
30
31 name = PathResolverFindFile ("x", "APATH");
32 std::cout << "2) [x] Name = " << name << " [expected : ]" << std::endl;
33
34 name = PathResolverFindDirectory ("x", "APATH");
35 std::cout << "3) [x] Name = " << name << " [expected : ../test/A/x]" << std::endl;
36
37 name = PathResolver::find_file ("b.txt", "APATH");
38 std::cout << "4) [b.txt] Name = " << name << " [expected : ../test/A/b.txt]" << std::endl;
39
40 name = PathResolver::find_file ("c.txt", "APATH");
41 std::cout << "5) [c.txt] Name = " << name << " [expected : ../src/dd.txt]" << std::endl;
42
43 name = PathResolver::find_file ("A/a.txt", "APATH");
44 std::cout << "6) [A/a.txt] Name = " << name << " [expected : ../test/A/a.txt]" << std::endl;
45
46 name = PathResolver::find_file ("A/d.txt", "APATH");
47 std::cout << "7) [A/d.txt] Name = " << name << " [expected : ]" << std::endl;
48
49 name = PathResolver::find_file ("A/e.txt", "APATH");
50 std::cout << "8) [A/e.txt] Name = " << name << " [expected : ]" << std::endl;
51
53 std::cout << "9) [e.txt] Name = " << name << " [expected : ./s/t/u/e.txt]" << std::endl;
54
55}
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
std::string PathResolverFindDirectory(const std::string &logical_file_name, const std::string &search_path)
std::string PathResolverFindFile(const std::string &logical_file_name, const std::string &search_path)
int main()
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)