Struct subplotlib::steplibrary::datadir::Datadir
source · pub struct Datadir { /* private fields */ }Expand description
The Datadir is the context type which provides a directory for each scenario
and allows for the creation and testing of files within that directory.
A few steps are provided as part of this step library, though in reality the majority of steps which interact with the data directory are in the files step library, and commands which interact with stuff in here are in the runcmd step library.
Implementations§
source§impl Datadir
impl Datadir
sourcepub fn base_path(&self) -> &Path
pub fn base_path(&self) -> &Path
Retrieve the base data directory path which can be used to store files etc. for this step.
This is used by steps wishing to manipulate the content of the data directory.
sourcepub fn canonicalise_filename<S: AsRef<Path>>(
&self,
subpath: S
) -> Result<PathBuf, StepError>
pub fn canonicalise_filename<S: AsRef<Path>>( &self, subpath: S ) -> Result<PathBuf, StepError>
Canonicalise a subpath into this dir
This step safely joins the base path to the given subpath. This ensures that,
for example, the subpath is relative, does not contain .. elements, etc.
sourcepub fn open_write<S: AsRef<Path>>(&self, subpath: S) -> Result<File, StepError>
pub fn open_write<S: AsRef<Path>>(&self, subpath: S) -> Result<File, StepError>
Open a file for writing
This is a convenience function to open a file for writing at the given subpath.