Skip to content

Commit

Permalink
use exists instead of is_file
Browse files Browse the repository at this point in the history
  • Loading branch information
Adinata Wijaya committed Sep 4, 2024
1 parent 96316de commit bcf8cdc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/repo_tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,11 @@ async fn get_file_cached<P: AsRef<Path>>(

let temp_file =
primitives::download_file(metadata, &repo_url, access_token, randomizer_bytes).await?;
if cache_file.is_file() {
info!("cache file {:?} is already written from other process", &cache_file);
if cache_file.exists() {
info!(
"cache file {:?} is already written from other process",
&cache_file
);
} else {
fs::rename(&temp_file.path(), cache_file.as_path())
.map_err(|e| {
Expand Down

0 comments on commit bcf8cdc

Please sign in to comment.