From 8f0a3304c36263f8011903408cb517f4fa96f4f6 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Thu, 11 Sep 2025 10:24:27 -0400 Subject: [PATCH] Respect `--project` in `uv init` when a path is provided --- crates/uv/src/commands/project/init.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/uv/src/commands/project/init.rs b/crates/uv/src/commands/project/init.rs index 794bafc75..1e4df34f5 100644 --- a/crates/uv/src/commands/project/init.rs +++ b/crates/uv/src/commands/project/init.rs @@ -96,10 +96,17 @@ pub(crate) async fn init( )?; } InitKind::Project(project_kind) => { - // Default to the current directory if a path was not provided. + // Default to the current "project" directory if a path was not provided. let path = match explicit_path { None => project_dir.to_path_buf(), - Some(ref path) => std::path::absolute(path)?, + Some(ref path) => { + // Otherwise, resolve paths relative to the `--project` option + if path.is_relative() { + project_dir.join(path) + } else { + std::path::absolute(path)? + } + } }; // Make sure a project does not already exist in the given directory.