[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?).
This commit is contained in:
schneems 2023-03-07 17:49:11 -06:00 committed by Hiroshi SHIBATA
parent 588dd44d41
commit 33cfd262fc

View File

@ -91,7 +91,9 @@ module SyntaxSuggest
dir = Pathname(dir) dir = Pathname(dir)
dir.join(time).tap { |path| dir.join(time).tap { |path|
path.mkpath 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 end