Skip to content

Commit

Permalink
fix: find gradle is windows compatible now
Browse files Browse the repository at this point in the history
  • Loading branch information
SyedAhkam committed Oct 6, 2023
1 parent c7c21f6 commit 0c341ba
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
use anyhow::{anyhow, Context, Result};
use which::which;

use std::path::Path;

pub fn prompt_for_input(prompt: &str, default: Option<String>) -> Result<String> {
let theme = dialoguer::theme::ColorfulTheme::default();
let mut builder = dialoguer::Input::<String>::with_theme(&theme);
Expand Down Expand Up @@ -40,8 +42,14 @@ pub fn safe_name(name: String) -> String {
}

pub fn find_gradle() -> Option<String> {
if std::path::Path::new("./gradlew").exists() {
return Some("./gradlew".to_owned());
let curr_dir_gradle = if cfg!(windows) {
"./gradlew.bat"
} else {
"./gradlew"
};

if Path::new(curr_dir_gradle).exists() {
return Some(curr_dir_gradle.to_owned());
}

if which("gradle").is_ok() {
Expand Down

0 comments on commit 0c341ba

Please sign in to comment.