I just started testing out this tool the other day and so far it's great!
I began poking around the code and noticed this. It strikes me that the code below is unsafe. For example, if there's a directory or other file there it'll wipe it out without any warning.
|
if _, err := os.Lstat(symlinkPath); err == nil { |
|
if err := os.RemoveAll(symlinkPath); err != nil { |
|
return nil, fmt.Errorf("failed to remove existing item %s: %w", symlinkPath, err) |
|
} |
|
} |
Would you consider adding an option (maybe on by default) to stop and exit if it detects files, or at the least wait for user input to overwrite it? IIRC chezmoi does this.
There's a chance I'm just misunderstanding the flow of the code. If so please let me know.
I just started testing out this tool the other day and so far it's great!
I began poking around the code and noticed this. It strikes me that the code below is unsafe. For example, if there's a directory or other file there it'll wipe it out without any warning.
lnk/internal/core/lnk.go
Lines 677 to 681 in 430619b
Would you consider adding an option (maybe on by default) to stop and exit if it detects files, or at the least wait for user input to overwrite it? IIRC chezmoi does this.
There's a chance I'm just misunderstanding the flow of the code. If so please let me know.