From ae5a336f2d43f851756b5c57a7bcef28693f1781 Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Mon, 6 Mar 2023 18:20:27 +0200 Subject: [PATCH] add sdk install info --- src/sdk.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/sdk.rs b/src/sdk.rs index 651489a..5c66150 100644 --- a/src/sdk.rs +++ b/src/sdk.rs @@ -194,6 +194,17 @@ fn set_sdk_env(path: &Path) -> bool { env_success } +fn get_sdk_path() -> Option { + if std::env::var("GEODE_SDK").is_ok() && + Config::try_sdk_path().is_ok() + { + Some(Config::sdk_path()) + } + else { + None + } +} + fn install(config: &mut Config, path: PathBuf, force: bool) { let parent = path.parent().unwrap(); @@ -479,6 +490,18 @@ pub fn subcommand(config: &mut Config, cmd: Sdk) { return; } + if !force { + if let Some(path) = get_sdk_path() { + fatal!( + "SDK is already installed at {} - if you meant to \ + update the SDK, use `geode sdk update`, or if you \ + want to change the install location use the --reinstall \ + option", + path.display() + ); + } + } + let actual_path = match path { Some(p) => p, None => {