Drake
Drake C++ Documentation
Loading...
Searching...
No Matches
find_resource.h File Reference
#include <filesystem>
#include <optional>
#include <string>
#include <vector>
#include "drake/common/drake_assert.h"
#include "drake/common/drake_copyable.h"
Include dependency graph for find_resource.h:

Classes

class  FindResourceResult
 Models the outcome of drake::FindResource. More...

Namespaces

namespace  drake

Functions

FindResourceResult FindResource (const std::string &resource_path)
 (Advanced) Attempts to locate a Drake resource named by the given resource_path.
std::string FindResourceOrThrow (const std::string &resource_path)
 (Advanced) Convenient wrapper for querying FindResource(resource_path) followed by FindResourceResult::get_absolute_path_or_throw().
std::optional< std::string > ReadFile (const std::filesystem::path &path)
 Returns the content of the file at the given path, or nullopt if it cannot be read.
std::string ReadFileOrThrow (const std::filesystem::path &path)
 Returns the content of the file at the given path, or throws if it cannot be read.

Variables

const char *const kDrakeResourceRootEnvironmentVariableName
 The name of the environment variable that provides the first place where FindResource attempts to look.