On Jun 3, 2019, at 13:03, Andrew Udvare wrote:
> I got really confused on the use of the `copy` command when it comes to
> copying a complete directory tree to another place when it involves the DMG
> contents, with the name of the directory.
>
> If I do these (where x and y are both directories):
>
> copy x y/
> copy x y
> copy x/ y
>
> Assuming x/file exists and is a file, this creates y/file and not y/x/file.
>
> My workaround is to copy two items even if I do not use all the arguments
> later.
> https://github.com/Tatsh/ports/blob/master/multimedia/makemkv/Portfile#L42
> note the MakeMKV.url argument. This makes the copy command create MakeMKV.app
> in ${worksrcpath} instead of skipping it for the content.
>
> The Tcl documentation says file copy is affected by cross-file system
> transactions, which may explain why the destroot {} copy works as expected.
I'm not sure what you mean.
You wrote:
copy ${mountpoint}/MakeMKV.app ${mountpoint}/MakeMKV.url ${worksrcpath}/
This works fine and copies the directory MakeMKV.app and the file MakeMKV.url
into the directory ${worksrcpath}.
But since you don't need MakeMKV.url it also works fine to just write:
copy ${mountpoint}/MakeMKV.app ${worksrcpath}
The copy procedure does not behave differently depending on how many source
items there are, and it does not be have differently depending on whether or
not you put a slash at the end of directory entries. It does not behave
differently in destroot than it does in other cases, and the only thing I could
find in the Tcl documentation about copying across filesystems is that symlinks
are only preserved when copying within a single filesystem, which isn't
applicable here since you're not copying symlinks.