Skip to content

Commit 5c2bf6b

Browse files
committed
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?).
1 parent e0c53bb commit 5c2bf6b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/syntax_suggest/api.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ def self.record_dir(dir)
9191
dir = Pathname(dir)
9292
dir.join(time).tap { |path|
9393
path.mkpath
94-
FileUtils.ln_sf(time, dir.join("last"))
94+
alias_dir = dir.join("last")
95+
FileUtils.rm_rf(alias_dir) if alias_dir.exist?
96+
FileUtils.ln_sf(time, alias_dir)
9597
}
9698
end
9799

0 commit comments

Comments
 (0)