| 38 | namespace osvr { |
| 39 | namespace 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; |
no test coverage detected