MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / getPluginSearchPath

Function getPluginSearchPath

src/osvr/PluginHost/SearchPath.cpp:40–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38namespace osvr {
39namespace pluginhost {
40 SearchPath getPluginSearchPath() {
41 boost::filesystem::path exeLocation(getBinaryLocation());
42#ifdef __ANDROID__
43 OSVR_DEV_VERBOSE("Binary location: " << exeLocation);
44#endif
45 // Should be something like PREFIX/bin or PREFIX/bin/Release (depending
46 // on if we're installed or in a build tree)
47 auto binDir = exeLocation.parent_path();
48#ifdef _MSC_VER
49 /// CMAKE_INTDIR is a string like "Debug", defined automatically
50 if (binDir.filename() == CMAKE_INTDIR) {
51 binDir = binDir.parent_path();
52 }
53#endif
54 // binDir now normalized to PREFIX/bin
55 auto root = binDir.parent_path();
56
57 SearchPath paths;
58
59#ifdef __ANDROID__
60 // current working directory, if different from root
61 auto currentWorkingDirectory = boost::filesystem::current_path();
62 if (currentWorkingDirectory != root) {
63 paths.push_back((currentWorkingDirectory / OSVR_PLUGIN_DIR).string());
64 }
65#endif
66
67#ifdef _MSC_VER
68 paths.push_back((root / OSVR_PLUGIN_DIR / CMAKE_INTDIR).string());
69#endif
70 paths.push_back((root / OSVR_PLUGIN_DIR).string());
71
72 /// @todo add user's home directory to search path
73
74 return paths;
75 }
76
77 FileList getAllFilesWithExt(SearchPath dirPath, const std::string &ext) {
78 FileList filesPaths;

Callers 2

findPluginFunction · 0.85
loadPluginsMethod · 0.85

Calls 2

getBinaryLocationFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected