diff options
-rw-r--r-- | src/db/models/artifact.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/db/models/artifact.rs b/src/db/models/artifact.rs index 8ce2192..fa3774b 100644 --- a/src/db/models/artifact.rs +++ b/src/db/models/artifact.rs @@ -1,4 +1,5 @@ use std::path::Path; +use std::path::PathBuf; use anyhow::anyhow; use anyhow::Error; @@ -29,6 +30,10 @@ struct NewArtifact<'a> { } impl Artifact { + pub fn path_buf(&self) -> PathBuf { + PathBuf::from(&self.path) + } + pub fn create(database_connection: &PgConnection, art_path: &Path, art_released: bool, job: &Job) -> Result<Artifact> { let path_str = art_path.to_str() .ok_or_else(|| anyhow!("Path is not valid UTF-8: {}", art_path.display())) |