Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ features = [
"Win32_Foundation",
"Win32_Security",
"Win32_Storage_FileSystem",
"Win32_System_Com",
"Win32_System_Console",
"Win32_System_Diagnostics_ToolHelp",
"Win32_System_IO",
Expand All @@ -130,6 +131,7 @@ features = [
"Win32_System_Threading",
"Win32_System_WindowsProgramming",
"Win32_UI",
"Win32_UI_Shell",
"Win32_UI_WindowsAndMessaging",
]
version = "0.61"
Expand Down
2 changes: 1 addition & 1 deletion src/cli/proxy_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub async fn main(
current_dir: PathBuf,
process: &Process,
) -> anyhow::Result<ExitStatus> {
self_update::cleanup_self_updater(process, &process.cargo_home()?.join("bin"))?;
self_update::cleanup_self_updater(process, &process.bin_home()?)?;

let _setup = job::setup();
let mut args = process.args_os().skip(1);
Expand Down
49 changes: 40 additions & 9 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ enum ShowSubcmd {
verbose: bool,
},

/// Display the computed value of RUSTUP_HOME
/// Display resolved Rustup home directories
Home,

/// Show the default profile used for the `rustup install` command
Expand Down Expand Up @@ -700,7 +700,7 @@ pub async fn main(
.bin("rustup")
.complete();

self_update::cleanup_self_updater(process, &process.cargo_home()?.join("bin"))?;
self_update::cleanup_self_updater(process, &cfg.bin_dir)?;

use clap::error::ErrorKind::*;
let matches = match Rustup::try_parse_from(process.args_os()) {
Expand Down Expand Up @@ -1318,14 +1318,27 @@ async fn show(cfg: &Cfg<'_>, verbose: bool) -> anyhow::Result<ExitCode> {
cfg.default_host_tuple()?
)?;

// Print rustup home directory
{
let mut t = t.lock();
writeln!(
t,
"{HEADER}rustup home: {HEADER:#}{}",
cfg.rustup_dir.display()
)?;
if cfg.process.use_category_home() {
writeln!(t, "{HEADER}rustup homes:{HEADER:#}")?;
for (name, home) in [
("config", &cfg.config_dir),
("state", &cfg.state_dir),
("data", &cfg.data_dir),
("cache", &cfg.cache_dir),
("bin", &cfg.bin_dir),
] {
writeln!(t, " {name}: {}", home.display())?;
}
} else {
// In legacy mode, all four category homes equal the resolved RUSTUP_HOME.
writeln!(
t,
"{HEADER}rustup home: {HEADER:#}{}",
cfg.data_dir.display()
)?;
}
writeln!(t)?;
}

Expand Down Expand Up @@ -1473,7 +1486,21 @@ async fn show_active_toolchain(cfg: &Cfg<'_>, verbose: bool) -> anyhow::Result<E

#[tracing::instrument(level = "trace", skip_all)]
fn show_rustup_home(cfg: &Cfg<'_>) -> anyhow::Result<ExitCode> {
writeln!(cfg.process.stdout().lock(), "{}", cfg.rustup_dir.display())?;
let mut stdout = cfg.process.stdout().lock();
if !cfg.process.use_category_home() {
// In legacy mode, all four category homes equal the resolved RUSTUP_HOME.
writeln!(stdout, "{}", cfg.data_dir.display())?;
return Ok(ExitCode::SUCCESS);
}

for (name, home) in [
("config", &cfg.config_dir),
("state", &cfg.state_dir),
("data", &cfg.data_dir),
("cache", &cfg.cache_dir),
] {
writeln!(stdout, "{name}: {}", home.display())?;
}
Ok(ExitCode::SUCCESS)
}

Expand Down Expand Up @@ -2191,6 +2218,10 @@ date = "2025-01-01"
"RUSTUP_HOME".to_owned(),
rustup_home.path().display().to_string(),
),
(
"CARGO_HOME".to_owned(),
rustup_home.path().display().to_string(),
),
(
"RUSTUP_OVERRIDE_UNIX_FALLBACK_SETTINGS".to_owned(),
rustup_home
Expand Down
Loading
Loading