otiai10 / copy

Go copy directory recursively
https://pkg.go.dev/github.com/otiai10/copy
MIT License
722 stars 115 forks source link

Deep symlink copy doesn't work with relative `../foo` target #97

Closed samuel-phan closed 10 months ago

samuel-phan commented 1 year ago

Deep symlink copy will fail in this situation:

test
├── data
│   ├── case00
│   │   └── README.md
│   ├── case01
│   │   └── README.md
│   ├── case02
│   │   └── README.md
│   ├── case03
│   │   ├── README.md
│   │   ├── case01 -> test/data/case01
│   │   └── relative_case01 -> ../case01

Though it's entirely acceptable to have a symlink working only at a certain current working dir, most of the time, we have symlinks:

kernel164 commented 12 months ago
Screenshot 2023-11-13 at 9 51 28 PM

changing from os.Readlink to filepath.EvalSymlinks worked in my local.