core/testlib/testlib_root_dir.cxx
Go to the documentation of this file.
00001 // This is core/testlib/testlib_root_dir.cxx
00002 #include "testlib_root_dir.h"
00003 //:
00004 // \file
00005 
00006 #include <vcl_cstdlib.h>
00007 #include <vcl_iostream.h>
00008 
00009 // The following should have been created automatically by the
00010 // configuration scripts from vcl_where_root_dir.h.in
00011 // We need to check for its existence and if it doesn't exist - do something else.
00012 #ifdef VCL_WHERE_ROOT_DIR_H_EXISTS
00013 #include <vcl_where_root_dir.h>
00014 //: Return source root directory (ie the one just below vcl).
00015 vcl_string testlib_root_dir()
00016 {
00017   return vcl_string(VCL_SOURCE_ROOT_DIR);
00018 }
00019 #else
00020 //: Return source root directory (ie the one just below vcl and vxl).
00021 vcl_string testlib_root_dir()
00022 {
00023   char* ptr;
00024 
00025   ptr= vcl_getenv("VXLSRC");
00026   if (ptr)
00027     return vcl_string(ptr);
00028 
00029   ptr= vcl_getenv("VCLSRC");
00030   if (ptr)
00031     return vcl_string(ptr);
00032 
00033   ptr= vcl_getenv("VXL_SRC");
00034   if (ptr)
00035     return vcl_string(ptr);
00036 
00037   vcl_cerr<<"ERROR: testlib_root_dir() Unable to retrieve directory from\n"
00038           <<"$VCLSRC or $VXLSRC or $VXL_SRC.  Sorry.\n";
00039   return vcl_string("");
00040 }
00041 
00042 #endif