Many thanks,
I guess my problem is that I am not clear on how to store argv[0] so
that my tests can access it as I have a small main.cpp and plenty of
tests-....cpp files for the tests. So I ended up creating a global
variable, setting it when main() is called and declaring it as extern
in my tests-....cpp files:
main.cpp:
#include <gtest/gtest.h>
#include <boost/filesystem.hpp>
boost::filesystem::path RelativePath = "";
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
RelativePath = boost::filesystem::path(argv[0]).parent_path();
return RUN_ALL_TESTS();
}
tests-....cpp files:
#include <boost/filesystem.hpp>
extern boost::filesystem::path RelativePath;
...
file.open((RelativePath/"...").string());
...
Sylvain
On Nov 4, 9:13 am, Josh Kelley <
josh...@gmail.com> wrote: