From 0c341ba3985c4adaa28b8d56b9d6c32fc42ed368 Mon Sep 17 00:00:00 2001 From: SyedAhkam Date: Sat, 7 Oct 2023 04:54:32 +0530 Subject: [PATCH] fix: find gradle is windows compatible now --- src/utils.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index 0e3aaa1..179d783 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -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) -> Result { let theme = dialoguer::theme::ColorfulTheme::default(); let mut builder = dialoguer::Input::::with_theme(&theme); @@ -40,8 +42,14 @@ pub fn safe_name(name: String) -> String { } pub fn find_gradle() -> Option { - 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() {