Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
improve doc
Browse files Browse the repository at this point in the history
  • Loading branch information
cecton committed Jun 8, 2020
1 parent 39bc022 commit cb140b6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions client/service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,22 @@ pub enum BasePath {
}

impl BasePath {
/// Create a temporary directory prefixed with "substrate" and use it as base path.
/// Create a `BasePath` instance using a temporary directory prefixed with "substrate" and use
/// it as base path.
///
/// Note: the temporary directory will be created automatically and deleted when the `BasePath`
/// instance is dropped.
#[cfg(not(target_os = "unknown"))]
pub fn new_temp_dir() -> io::Result<BasePath> {
Ok(BasePath::Temporary(
tempfile::Builder::new().prefix("substrate").tempdir()?,
))
}

/// Create a base path based on an existing path on disk.
/// Create a `BasePath` instance based on an existing path on disk.
///
/// Note: this function will not ensure that the directory exist nor create the directory. It
/// will also not delete the directory when the instance is dropped.
pub fn new<P: AsRef<Path>>(path: P) -> BasePath {
BasePath::Permanenent(path.as_ref().to_path_buf())
}
Expand Down

0 comments on commit cb140b6

Please sign in to comment.