Skip to content

Commit

Permalink
add sdk install info
Browse files Browse the repository at this point in the history
  • Loading branch information
HJfod committed Mar 6, 2023
1 parent 872674c commit ae5a336
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,17 @@ fn set_sdk_env(path: &Path) -> bool {
env_success
}

fn get_sdk_path() -> Option<PathBuf> {
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();

Expand Down Expand Up @@ -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 => {
Expand Down

0 comments on commit ae5a336

Please sign in to comment.