From 33cfd262fcfe65737b6d4cde416a24cd81406885 Mon Sep 17 00:00:00 2001 From: schneems Date: Tue, 7 Mar 2023 17:49:11 -0600 Subject: [ruby/syntax_suggest] Handle alias already exists when debugging When `tmp/alias` already exists, I'm now getting phantom folders in the directory pointing at older aliases which is distracting/confusing. By checking and removing that alias before symlinking we can prevent this strange behavior (possibly caused by newer Mac OS?). --- lib/syntax_suggest/api.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/syntax_suggest/api.rb') diff --git a/lib/syntax_suggest/api.rb b/lib/syntax_suggest/api.rb index 5b725e13d7..ad8f641dbf 100644 --- a/lib/syntax_suggest/api.rb +++ b/lib/syntax_suggest/api.rb @@ -91,7 +91,9 @@ module SyntaxSuggest dir = Pathname(dir) dir.join(time).tap { |path| path.mkpath - FileUtils.ln_sf(time, dir.join("last")) + alias_dir = dir.join("last") + FileUtils.rm_rf(alias_dir) if alias_dir.exist? + FileUtils.ln_sf(time, alias_dir) } end -- cgit v1.2.3