diff --git a/CHANGELOG.md b/CHANGELOG.md index fcb0ae22..b7720543 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### yabridgectl + +- Fixed issue with overwriting broken symlinks during `yabridgectl sync`. + ## [1.4.0] - 2020-07-26 ### Added diff --git a/tools/yabridgectl/src/actions.rs b/tools/yabridgectl/src/actions.rs index b74aabe1..2122f6de 100644 --- a/tools/yabridgectl/src/actions.rs +++ b/tools/yabridgectl/src/actions.rs @@ -18,6 +18,7 @@ use anyhow::{Context, Result}; use colored::Colorize; +use std::fs; use std::path::{Path, PathBuf}; use crate::config::{Config, InstallationMethod}; @@ -173,9 +174,10 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> { } for plugin in search_results.vst2_files { // If the target file already exists, we'll remove it first to prevent issues with - // mixing symlinks and regular files + // mixing symlinks and regular files. We check `std::fs::symlink_metadata` instead of + // `Path::exists()` because the latter reports false for broken symlinks. let target_path = plugin.with_extension("so"); - if target_path.exists() { + if fs::symlink_metadata(&target_path).is_ok() { utils::remove_file(&target_path)?; }