From 33ff6b2f2345840668e00309332f5c19f60c180d Mon Sep 17 00:00:00 2001 From: appflowy Date: Thu, 17 Feb 2022 11:18:07 +0800 Subject: [PATCH] chore: update the prompt of protoc-gen-dart installation --- .../lib-infra/src/code_gen/protobuf_file/mod.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/shared-lib/lib-infra/src/code_gen/protobuf_file/mod.rs b/shared-lib/lib-infra/src/code_gen/protobuf_file/mod.rs index 25115c81bc..f35a46d1f1 100644 --- a/shared-lib/lib-infra/src/code_gen/protobuf_file/mod.rs +++ b/shared-lib/lib-infra/src/code_gen/protobuf_file/mod.rs @@ -133,10 +133,15 @@ fn check_pb_compiler() { } fn check_pb_dart_plugin() { - assert!( - run_command("command -v protoc-gen-dart"), - "protoc-gen-dart was not installed correctly" - ); + if cfg!(target_os = "windows") { + if !run_command("command -v protoc-gen-dart") { + panic!("{}", format!("\n❌ The protoc-gen-dart was not installed correctly.")) + } + } else { + if !run_command("command -v protoc-gen-dart") { + panic!("{}", format!("\n❌ The protoc-gen-dart was not installed correctly. \n✅ You can fix that by adding \"{}\" to your shell's config file.(.bashrc, .bash, etc.)", "dart pub global activate protoc_plugin")) + } + }; } fn run_command(cmd: &str) -> bool {