Skip to content

Commit

Permalink
create .pixi/build-v0 only when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Nov 28, 2024
1 parent 08b09c0 commit a44734f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ pub enum BuildError {

#[error(transparent)]
BuildCacheError(#[from] cache::BuildCacheError),

#[error(transparent)]
BuildFolderNotWritable(#[from] std::io::Error),
}

/// Location of the source code for a package. This will be used as the input
Expand Down Expand Up @@ -116,16 +119,13 @@ impl BuildContext {
channel_config: ChannelConfig,
tool_context: Arc<ToolContext>,
) -> Result<Self, std::io::Error> {
let work_dir = dot_pixi_dir.join("build-v0");
fs::create_dir_all(&work_dir)?;

Ok(Self {
channel_config,
glob_hash_cache: GlobHashCache::default(),
source_metadata_cache: SourceMetadataCache::new(cache_dir.clone()),
build_cache: BuildCache::new(cache_dir.clone()),
cache_dir,
work_dir,
work_dir: dot_pixi_dir.join("build-v0"),
tool_context,
})
}
Expand Down Expand Up @@ -256,6 +256,8 @@ impl BuildContext {
}
}

fs::create_dir_all(&self.work_dir).map_err(|e| BuildError::BuildFolderNotWritable(e))?;

Check failure on line 259 in src/build/mod.rs

View workflow job for this annotation

GitHub Actions / Cargo Lint

redundant closure

let tool_context = ToolContext::builder()
.with_gateway(gateway.clone())
.with_client(authenticated_client.clone())
Expand Down

0 comments on commit a44734f

Please sign in to comment.