src/UserSpaceInstrumentation/InstrumentProcess.cpp
ErrorMessageOr<std::filesystem::path> GetLibraryPath() {
  // When packaged, liborbituserspaceinstrumentation.so is found alongside OrbitService. In
  // development, it is found in "../lib", relative to OrbitService.
  constexpr const char* kLibName = "liborbituserspaceinstrumentation.so";
  const std::filesystem::path exe_dir = orbit_base::GetExecutableDir();
  std::vector<std::filesystem::path> potential_paths = {exe_dir / kLibName,
                                                        exe_dir / ".." / "lib" / kLibName};
  /* copybara:insert(In internal tests the library is in a different place)
  potential_paths.emplace_back(initial_current_path /
  "@@LIB_ORBIT_USER_SPACE_INSTRUMENTATION_PATH@@");
  */
  for (const auto& path : potential_paths) {
    if (std::filesystem::exists(path)) {
      return path;
    }
  }
  return ErrorMessage(absl::StrFormat("%s not found on system.", kLibName));
}
/* copybara:insert(In internal tests the library path depends on the current path)
// Since some part could potentially change the current working directory we store
// the initial value here.
const std::filesystem::path initial_current_path = std::filesystem::current_path();
*/
insert(In internal tests the library path depends on the current path)
Since some part could potentially change the current working directory we store
the initial value here.
insert ( In internal tests the library path depends on the current path ) Since some part could potentially change the current working directory we store the initial value here .
ErrorMessageOr<std::filesystem::path> GetLibraryPath() {
  constexpr const char* kLibName = "liborbituserspaceinstrumentation.so";
  const std::filesystem::path exe_dir = orbit_base::GetExecutableDir();
  std::vector<std::filesystem::path> potential_paths = {exe_dir / kLibName,
                                                        exe_dir / ".." / "lib" / kLibName};
  for (const auto& path : potential_paths) {
    if (std::filesystem::exists(path)) {
      return path;
    }
  }
  return ErrorMessage(absl::StrFormat("%s not found on system.", kLibName));
}
ErrorMessageOr < std :: filesystem :: path > GetLibraryPath ( ) { constexpr const char * kLibName = " " ; const std :: filesystem :: path exe_dir = orbit_base :: GetExecutableDir ( ) ; std :: vector < std :: filesystem :: path > potential_paths = { exe_dir / kLibName , exe_dir / " " / " " / kLibName } ; for ( const auto & path : potential_paths ) { if ( std :: filesystem :: exists ( path ) ) { return path ; } } return ErrorMessage ( absl :: StrFormat ( " " , kLibName ) ) ; }
copybara:insert(In internal tests the library path depends on the current path)
Since some part could potentially change the current working directory we store
the initial value here.
copybara : insert ( In internal tests the library path depends on the current path ) Since some part could potentially change the current working directory we store the initial value here .
// When packaged, liborbituserspaceinstrumentation.so is found alongside OrbitService. In // development, it is found in "../lib", relative to OrbitService. /* copybara:insert(In internal tests the library is in a different place)
  potential_paths.emplace_back(initial_current_path /
  "@@LIB_ORBIT_USER_SPACE_INSTRUMENTATION_PATH@@");
  */