Copy files from a packet to anywhere. Similar to outpack_packet_use_dependency except that this is not used in an active packet context. You can use this function to pull files from an outpack root to a directory outside of the control of outpack, for example.

outpack_copy_files(id, files, dest, allow_remote = FALSE, root = NULL)

Arguments

id

Optionally, an outpack id via outpack_id. If not given a new id will be generated.

files

A named character vector of files; the name corresponds to the name within the current packet, while the value corresponds to the name within the upstream packet

dest

The directory to copy into

allow_remote

Logical, indicating if we should attempt to retrieve the file from any remote location if it cannot be found locally. If the file is large, this may take some time depending on the speed of the connection. If you use a file store, note that this does add the downloaded file into your file store, though associated with no packet so that it is subject to garbage collection (once we write support for that).

root

The outpack root. Will be searched for from the current directory if not given.

Value

Nothing, invisibly. Primarily called for its side effect of copying files from a packet into the directory dest

Details

There are different ways that this might fail (or recover from failure):

  • if id is not known in the metadata store (not known because it's not unpacked but also not known to be present in some other remote) then this will fail because it's impossible to resolve the files. Consider refreshing the metadata with outpack_location_pull_metadata to refresh this.

  • if the id is not unpacked and no local copy of the files referred to can be found, we error by default (but see the next option). However, sometimes the file you refer to might also be present because you have downloaded a packet that depended on it, or because the content of the file is unchanged because from some other packet version you have locally.

  • if the id is not unpacked, there is no local copy of the file and if allow_remote is TRUE we will try and request the file from whatever remote would be selected by outpack_location_pull_packet for this packet.

Note that empty directories might be created on failure.