diff options
Diffstat (limited to 'src/source/mod.rs')
-rw-r--r-- | src/source/mod.rs | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/source/mod.rs b/src/source/mod.rs index ec0e2e2..7b84c30 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -47,14 +47,6 @@ pub struct SourceEntry { } impl SourceEntry { - fn source_file_path(&self) -> PathBuf { - self.source_file_directory().join(format!( - "{}-{}.source", - self.package_source_name, - self.package_source.hash().value() - )) - } - fn source_file_directory(&self) -> PathBuf { self.cache_root .join(format!("{}-{}", self.package_name, self.package_version)) @@ -75,12 +67,12 @@ impl SourceEntry { .collect() } - pub fn exists(&self) -> bool { - self.source_file_path().exists() - } - pub fn path(&self) -> PathBuf { - self.source_file_path() + self.source_file_directory().join(format!( + "{}-{}.source", + self.package_source_name, + self.package_source.hash().value() + )) } pub fn url(&self) -> &Url { @@ -92,13 +84,13 @@ impl SourceEntry { } pub async fn remove_file(&self) -> Result<()> { - let p = self.source_file_path(); + let p = self.path(); tokio::fs::remove_file(&p).await?; Ok(()) } pub async fn verify_hash(&self) -> Result<()> { - let p = self.source_file_path(); + let p = self.path(); trace!("Verifying : {}", p.display()); let reader = tokio::fs::OpenOptions::new() @@ -118,7 +110,7 @@ impl SourceEntry { } pub async fn create(&self) -> Result<tokio::fs::File> { - let p = self.source_file_path(); + let p = self.path(); trace!("Creating source file: {}", p.display()); if !self.cache_root.is_dir() { |