Get the name of an entry (root, file or directory) or update it with the
assign operator (<-
).
Usage
adf_entry_name(x, path, ...) <- value
adf_entry_name(x, path, ...)
# S3 method for class 'adf_file_con'
adf_entry_name(x, path, ...) <- value
# S3 method for class 'adf_device'
adf_entry_name(x, path, ...) <- value
# S3 method for class 'virtual_path'
adf_entry_name(x, path, ...) <- value
# S3 method for class 'adf_device.character'
adf_entry_name(x, path, ...) <- value
# S3 method for class 'adf_device.virtual_path'
adf_entry_name(x, path, ...) <- value
Arguments
- x
Either a virtual device or virtual path.
- path
A
virtual_path()
pointing to the targeted entry (file or directory). Should be omitted whenx
is already a virtual path.- ...
Ignored
- value
New name for the entry. The name will be sanitised and truncated before it is assigned to the entry.
Value
Returns the entry name of the requested path or in case of an assign
operation (<-
) an updated version of x
.
Examples
## ADZ files can only be opened in 'write protected' mode
## extract it to a temporary file to allow writing to the virtual disk
adf_file <- tempfile(fileext = ".adf")
decompress_adz(
system.file("example.adz", package = "adfExplorer2"),
adf_file)
## Open virtual device to demonstrate methods
my_device <- connect_adf(adf_file, write_protected = FALSE)
## rename a specific entry
adf_entry_name(my_device, "DF0:mods/mod.intro") <- "mod.music"
## rename disk (also possible with `volume_name<-()`)
adf_entry_name(my_device, "DF0:") <- "my_disk"
close(my_device)