testlib_root_dir.cxx
Go to the documentation of this file.
1 // This is core/testlib/testlib_root_dir.cxx
2 #include <cstdlib>
3 #include <iostream>
4 #include "testlib_root_dir.h"
5 //:
6 // \file
7 
8 #ifdef _MSC_VER
9 # include <vcl_msvc_warnings.h>
10 #endif
11 
12 // The following should have been created automatically by the
13 // configuration scripts from vcl_where_root_dir.h.in
14 // We need to check for its existence and if it doesn't exist - do something else.
15 #include <vcl_where_root_dir.h>
16 //: Return source root directory (ie the one just below vcl and vxl).
17 std::string testlib_root_dir()
18 {
19  char* ptr = std::getenv("VXLSRC");
20  if (ptr)
21  return std::string(ptr);
22 
23  ptr= std::getenv("VCLSRC");
24  if (ptr)
25  return std::string(ptr);
26 
27  ptr= std::getenv("VXL_SRC");
28  if (ptr)
29  return std::string(ptr);
30 
31  return std::string(VCL_SOURCE_ROOT_DIR);
32 
33  //std::cerr<<"ERROR: testlib_root_dir() Unable to retrieve directory from\n"
34  // <<"$VCLSRC or $VXLSRC or $VXL_SRC. Sorry.\n";
35  //return std::string("");
36 }
Function to return root directory (i.e.
std::string testlib_root_dir()
Return source root directory (ie the one just below vcl and vxl).