summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-12-03 10:32:28 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-12-03 10:32:39 +0100
commit55976b0ebf17f76c330b24a6660597b152af93c3 (patch)
treebc58932cfed7e1adf72658f9d6260e956de90d2a /src/db
parent7f6780635361bacce4a54fa09fe09dc02a344de9 (diff)
Add db::models::Artifact::path_buf() helper function
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/db')
-rw-r--r--src/db/models/artifact.rs5
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()))