Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FileUtils.ln_sf to override special file types #13896

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Oct 17, 2023

The current implementation using File.file? checks only if the destination is an ordinary file. But any kind of file should be deleted, regardless of its type. So File.exists? would be better suited here.

Also, we need to use rm_rf instead of File.delete because dest_path can be a directory.

@straight-shoota straight-shoota self-assigned this Oct 17, 2023
@straight-shoota straight-shoota changed the title Fix FileUtils.ln_sf to use File.delete? Fix FileUtils.ln_sf to delete special file types Oct 17, 2023
@straight-shoota straight-shoota changed the title Fix FileUtils.ln_sf to delete special file types Fix FileUtils.ln_sf to override special file types Oct 17, 2023
@straight-shoota straight-shoota added this to the 1.11.0 milestone Oct 18, 2023
@straight-shoota straight-shoota merged commit 9e84f6e into crystal-lang:master Oct 19, 2023
53 of 55 checks passed
@straight-shoota straight-shoota deleted the fix/file-utils-symlink-delete branch October 19, 2023 09:37
Blacksmoke16 pushed a commit to Blacksmoke16/crystal that referenced this pull request Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants