gate4agent_types/
executable.rs1use crate::RuntimePlatform;
2
3pub fn normalize_executable_name(
8 command_or_path: &str,
9 platform: RuntimePlatform,
10) -> String {
11 let basename = command_or_path
12 .trim()
13 .rsplit(['/', '\\'])
14 .next()
15 .unwrap_or_default();
16 if platform == RuntimePlatform::Windows {
17 let lowercase = basename.to_ascii_lowercase();
18 for suffix in [".exe", ".cmd", ".bat", ".ps1"] {
19 if let Some(stripped) = lowercase.strip_suffix(suffix) {
20 return stripped.to_owned();
21 }
22 }
23 lowercase
24 } else {
25 basename.to_owned()
26 }
27}