feat(pkg): add paths CopyFS function.

This commit is contained in:
Alexandre Pujol 2025-04-04 22:15:01 +02:00
parent ccb7ee9b15
commit 3b6b50cf63
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC

View file

@ -388,6 +388,12 @@ func CopyTo(src *Path, dst *Path) error {
return nil return nil
} }
// CopyFS copies the file system fsys into the directory dir,
// creating dir if necessary. It is the exivalent of os.CopyFS with Path.
func (p *Path) CopyFS(dst *Path) error {
return os.CopyFS(dst.String(), os.DirFS(p.String()))
}
// CopyDirTo recursively copies the directory denoted by the current path to // CopyDirTo recursively copies the directory denoted by the current path to
// the destination path. The source directory must exist and the destination // the destination path. The source directory must exist and the destination
// directory must NOT exist (no implicit destination name allowed). // directory must NOT exist (no implicit destination name allowed).