aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorRoman Melnikov2023-05-05 10:53:03 +0800
committerGitHub2023-05-05 10:53:03 +0800
commit6b0b6a1c2527e8b1ef370a308b6ef8903004ac47 (patch)
treec8ec6f665d7d0f0f5aa3905e489313f0ebd7832b /src/lib.rs
parentc2ea4e642dc50fd44b537e9860ec95867af30d39 (diff)
parent784e9ee24d977c99dcb5ba5aef81dae48cb899fb (diff)
Merge pull request #205 from serokell/rvem/improve-temp-path-handling
[Chore] Handle 'temp_path' as an actual 'Path' instead of 'String'
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 738fa81..bf1a6dc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -12,10 +12,12 @@ use thiserror::Error;
use flexi_logger::*;
-pub fn make_lock_path(temp_path: &str, closure: &str) -> String {
+use std::path::{Path, PathBuf};
+
+pub fn make_lock_path(temp_path: &Path, closure: &str) -> PathBuf {
let lock_hash =
&closure["/nix/store/".len()..closure.find('-').unwrap_or_else(|| closure.len())];
- format!("{}/deploy-rs-canary-{}", temp_path, lock_hash)
+ temp_path.join(format!("deploy-rs-canary-{}", lock_hash))
}
const fn make_emoji(level: log::Level) -> &'static str {
@@ -159,7 +161,7 @@ pub struct CmdOverrides {
pub auto_rollback: Option<bool>,
pub hostname: Option<String>,
pub magic_rollback: Option<bool>,
- pub temp_path: Option<String>,
+ pub temp_path: Option<PathBuf>,
pub confirm_timeout: Option<u16>,
pub sudo: Option<String>,
pub dry_activate: bool,