@@ -3,7 +3,7 @@ use template::Template;
33use crate :: colors:: * ;
44use crate :: internal:: template;
55use crate :: package_manager:: PackageManager ;
6- use std:: process:: Command ;
6+ use std:: process:: { Command , Output } ;
77
88fn is_rustc_installed ( ) -> bool {
99 Command :: new ( "rustc" )
@@ -34,15 +34,19 @@ fn is_trunk_installed() -> bool {
3434 . map ( |o| o. status . success ( ) )
3535 . unwrap_or ( false )
3636}
37- fn is_tauri_cli_installed ( ) -> bool {
37+ fn is_appropriate_tauri_cli_installed ( alpha : bool ) -> bool {
38+ let check = |o : Output | match o. status . success ( ) {
39+ true if alpha => String :: from_utf8_lossy ( & o. stderr )
40+ . split_once ( ' ' )
41+ . map ( |( _, v) | v. starts_with ( '2' ) )
42+ . unwrap_or ( false ) ,
43+ s => s,
44+ } ;
3845 Command :: new ( "cargo" )
39- . arg ( "tauri" )
40- . arg ( "-V" )
46+ . args ( [ "tauri" , "-V" ] )
4147 . output ( )
42- . map ( |o| {
43- let s = String :: from_utf8_lossy ( & o. stderr ) ;
44- !s. starts_with ( "error:" )
45- } )
48+ . map ( check)
49+ . or_else ( |_| Command :: new ( "tauri" ) . arg ( "-V" ) . output ( ) . map ( check) )
4650 . unwrap_or ( false )
4751}
4852fn is_wasm32_installed ( ) -> bool {
@@ -172,11 +176,11 @@ pub fn print_missing_deps(pkg_manager: PackageManager, template: Template, alpha
172176 (
173177 "Tauri CLI" ,
174178 if alpha {
175- format ! ( "Run `{BLUE}{BOLD}cargo install tauri-cli --version ^2.0.0-alpha{RESET}`" )
179+ format ! ( "Run `{BLUE}{BOLD}cargo install tauri-cli --version ' ^2.0.0-alpha' {RESET}`" )
176180 } else {
177181 format ! ( "Run `{BLUE}{BOLD}cargo install tauri-cli{RESET}`" )
178182 } ,
179- & is_tauri_cli_installed ,
183+ & || is_appropriate_tauri_cli_installed ( alpha ) ,
180184 pkg_manager. is_node ( ) || !template. needs_tauri_cli ( ) ,
181185 ) ,
182186 (
0 commit comments