diff --git a/Cargo.lock b/Cargo.lock index da57c8a..b1dc07c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -950,7 +950,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "wakatime-ls" -version = "0.1.0" +version = "0.1.1" dependencies = [ "arc-swap", "chrono", @@ -962,7 +962,7 @@ dependencies = [ [[package]] name = "wakatime-zed" -version = "0.1.0" +version = "0.1.1" dependencies = [ "zed_extension_api", ] diff --git a/Cargo.toml b/Cargo.toml index 829e328..5a61142 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wakatime-zed" -version = "0.1.0" +version = "0.1.1" edition = "2021" [dependencies] diff --git a/extension.toml b/extension.toml index 6403940..3e6546d 100644 --- a/extension.toml +++ b/extension.toml @@ -1,7 +1,7 @@ id = "wakatime" name = "wakatime" description = "Wakatime support." -version = "0.0.1" +version = "0.1.1" schema_version = 1 authors = ["bestgopher <84328409@qq.com>"] repository = "https://github.com/bestgopher/wakatime-zed" diff --git a/src/lib.rs b/src/lib.rs index c5bcc44..3674225 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -64,7 +64,7 @@ impl WakatimeExtension { let binary_path = if binary == "wakatime-cli" { format!("{version_dir}/{target_triple}") } else { - format!("{version_dir}/{target_triple}/{binary}") + format!("{version_dir}/{binary}") }; if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) { @@ -85,12 +85,16 @@ impl WakatimeExtension { for entry in entries { let entry = entry.map_err(|err| format!("failed to load directory entry {err}"))?; - if entry.file_name().to_str() != Some(&version_dir) { - fs::remove_dir_all(entry.path()).ok(); + if let Some(file_name) = entry.file_name().to_str() { + if file_name.starts_with(binary) && file_name != version_dir { + fs::remove_dir_all(entry.path()).ok(); + } } } } + zed::make_file_executable(&binary_path)?; + Ok(binary_path) } @@ -145,8 +149,6 @@ impl WakatimeExtension { let binary_path = self.download(language_server_id, "wakatime-cli", "wakatime/wakatime-cli")?; - zed::make_file_executable(&binary_path)?; - self.cached_wakatime_cli_binary_path = Some(binary_path.clone()); Ok(binary_path) diff --git a/wakatime-ls/Cargo.toml b/wakatime-ls/Cargo.toml index 0ce43c8..f3da998 100644 --- a/wakatime-ls/Cargo.toml +++ b/wakatime-ls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wakatime-ls" -version = "0.1.0" +version = "0.1.1" edition = "2021" repository = "https://github.com/bestgopher/wakatime-zed"