Title: | Access and Manipulate Amiga Disk Files |
---|---|
Description: | Amiga Disk Files (ADF) are virtual representations of 3.5 inch floppy disks for the Commodore Amiga. Most disk drives from other systems (including modern drives) are not able to read these disks. The 'adfExplorer' package enables you to establish R connections to files on such virtual DOS-formatted disks, which can be use to read from and write to those files. |
Authors: | Pepijn de Vries [aut, cre] , Laurent Clévy [aut, cph] (Creator of the original ADFlib library) |
Maintainer: | Pepijn de Vries <[email protected]> |
License: | GPL (>= 3) |
Version: | 2.0.0 |
Built: | 2024-12-23 19:11:43 UTC |
Source: | CRAN |
adf_directory()
shows the current directory of a virtual device, when a file
system is present. When connecting to or creating a new device, the current
directory is the disk's root by default. To change the current directory,
use adf_directory()
in combination with the assign operator (<-
).
adf_directory(dev, ...) ## S3 method for class 'adf_device' adf_directory(dev, ...) adf_directory(dev, ...) <- value ## S3 replacement method for class 'adf_device' adf_directory(dev, ...) <- value ## S3 replacement method for class 'adf_device.character' adf_directory(dev, ...) <- value ## S3 replacement method for class 'adf_device.virtual_path' adf_directory(dev, ...) <- value make_adf_dir(x, path, ...) ## S3 method for class 'adf_device' make_adf_dir(x, path, ...) ## S3 method for class 'virtual_path' make_adf_dir(x, path, ...) ## S3 method for class 'character' make_adf_dir.adf_device(x, path, ...) ## S3 method for class 'virtual_path' make_adf_dir.adf_device(x, path, ...)
adf_directory(dev, ...) ## S3 method for class 'adf_device' adf_directory(dev, ...) adf_directory(dev, ...) <- value ## S3 replacement method for class 'adf_device' adf_directory(dev, ...) <- value ## S3 replacement method for class 'adf_device.character' adf_directory(dev, ...) <- value ## S3 replacement method for class 'adf_device.virtual_path' adf_directory(dev, ...) <- value make_adf_dir(x, path, ...) ## S3 method for class 'adf_device' make_adf_dir(x, path, ...) ## S3 method for class 'virtual_path' make_adf_dir(x, path, ...) ## S3 method for class 'character' make_adf_dir.adf_device(x, path, ...) ## S3 method for class 'virtual_path' make_adf_dir.adf_device(x, path, ...)
dev |
The virtual adf device for which information needs to be obtained.
It should be of class |
... |
Ignored |
value |
A |
x |
An |
path |
A |
To create a new directory on a device use make_adf_dir()
and use a full or
relative path name to specify the new directory name.
See vignette("virtual_paths")
for a note on file and directory names on the Amiga.
make_adf_dir()
returns the device connection. adf_directory()
returns
the current directory as a virtual_path
class object.
Pepijn de Vries
## 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 = "adfExplorer"), adf_file) ## Open virtual device to demonstrate methods my_device <- connect_adf(adf_file, write_protected = FALSE) ## Show the current directory adf_directory(my_device) ## Create a new directory make_adf_dir(my_device, "DF0:s/newdir") ## Change the current dir to the new directory: adf_directory(my_device) <- "DF0:s/newdir" ## Close the virtual device close(my_device)
## 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 = "adfExplorer"), adf_file) ## Open virtual device to demonstrate methods my_device <- connect_adf(adf_file, write_protected = FALSE) ## Show the current directory adf_directory(my_device) ## Create a new directory make_adf_dir(my_device, "DF0:s/newdir") ## Change the current dir to the new directory: adf_directory(my_device) <- "DF0:s/newdir" ## Close the virtual device close(my_device)
Retrieve information from entry (file and directory) headers on virtual ADF devices. Get information like entry name, modification date, file size etc.
adf_entry_info(x, path, ...) ## S3 method for class 'adf_device' adf_entry_info(x, path, ...) ## S3 method for class 'virtual_path' adf_entry_info.adf_device(x, path, ...) ## S3 method for class 'character' adf_entry_info.adf_device(x, path, ...) ## S3 method for class 'virtual_path' adf_entry_info(x, path, ...) ## S3 method for class 'adf_file_con' adf_entry_info(x, path, ...)
adf_entry_info(x, path, ...) ## S3 method for class 'adf_device' adf_entry_info(x, path, ...) ## S3 method for class 'virtual_path' adf_entry_info.adf_device(x, path, ...) ## S3 method for class 'character' adf_entry_info.adf_device(x, path, ...) ## S3 method for class 'virtual_path' adf_entry_info(x, path, ...) ## S3 method for class 'adf_file_con' adf_entry_info(x, path, ...)
x |
Either a virtual device or virtual path. |
path |
A |
... |
Ignored |
Returns a list
of named list
s of entry properties.
Elements included in the named list
depend on the type of entry (root, directory or file).
Pepijn de Vries
## First setup a connection to a virtual device adz_file <- system.file("example.adz", package = "adfExplorer") my_device <- connect_adf(adz_file) adf_entry_info(my_device, "DF0:") adf_entry_info(my_device, "s") adf_entry_info(my_device, "s/startup-sequence") close(my_device)
## First setup a connection to a virtual device adz_file <- system.file("example.adz", package = "adfExplorer") my_device <- connect_adf(adz_file) adf_entry_info(my_device, "DF0:") adf_entry_info(my_device, "s") adf_entry_info(my_device, "s/startup-sequence") close(my_device)
Get the name of an entry (root, file or directory) or update it with the
assign operator (<-
).
adf_entry_name(x, path, ...) <- value adf_entry_name(x, path, ...) ## S3 replacement method for class 'adf_file_con' adf_entry_name(x, path, ...) <- value ## S3 replacement method for class 'adf_device' adf_entry_name(x, path, ...) <- value ## S3 replacement method for class 'virtual_path' adf_entry_name(x, path, ...) <- value ## S3 replacement method for class 'adf_device.character' adf_entry_name(x, path, ...) <- value ## S3 replacement method for class 'adf_device.virtual_path' adf_entry_name(x, path, ...) <- value
adf_entry_name(x, path, ...) <- value adf_entry_name(x, path, ...) ## S3 replacement method for class 'adf_file_con' adf_entry_name(x, path, ...) <- value ## S3 replacement method for class 'adf_device' adf_entry_name(x, path, ...) <- value ## S3 replacement method for class 'virtual_path' adf_entry_name(x, path, ...) <- value ## S3 replacement method for class 'adf_device.character' adf_entry_name(x, path, ...) <- value ## S3 replacement method for class 'adf_device.virtual_path' adf_entry_name(x, path, ...) <- value
x |
Either a virtual device or virtual path. |
path |
A |
... |
Ignored |
value |
New name for the entry. The name will be sanitised and truncated before it is assigned to the entry. |
Returns the entry name of the requested path or in case of an assign
operation (<-
) an updated version of x
.
Pepijn de Vries
## 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 = "adfExplorer"), 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)
## 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 = "adfExplorer"), 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)
Open a connection to a file on a virtual ADF device. The created connection (if valid)
should be accepted by any R function that reads from or writes to a connection,
such as readLines()
, writeLines()
, readBin()
, writeBin()
, etc.
adf_file_con(x, ..., writable = FALSE) ## S3 method for class 'adf_device' adf_file_con(x, path, ..., writable = FALSE) ## S3 method for class 'character' adf_file_con.adf_device(x, path, ..., writable = FALSE) ## S3 method for class 'virtual_path' adf_file_con(x, ..., writable = FALSE)
adf_file_con(x, ..., writable = FALSE) ## S3 method for class 'adf_device' adf_file_con(x, path, ..., writable = FALSE) ## S3 method for class 'character' adf_file_con.adf_device(x, path, ..., writable = FALSE) ## S3 method for class 'virtual_path' adf_file_con(x, ..., writable = FALSE)
x |
Either a connection to a virtual ADF device created with |
... |
Ignored. |
writable |
A |
path |
Only required when |
Returns an R connection that can be handled by any function that
accepts a connection for reading or writing. Remember to call close()
after
use.
Pepijn de Vries
## First setup a connection to a virtual device adz_file <- system.file("example.adz", package = "adfExplorer") my_device <- connect_adf(adz_file) ## Open a connection to a file on the virtual device fcon <- adf_file_con(my_device, "DF0:s/startup-sequence") ## Read from the file my_startup <- readLines(fcon, warn = FALSE) ## Close the file close(fcon) ## Close the virtual device close(my_device)
## First setup a connection to a virtual device adz_file <- system.file("example.adz", package = "adfExplorer") my_device <- connect_adf(adz_file) ## Open a connection to a file on the virtual device fcon <- adf_file_con(my_device, "DF0:s/startup-sequence") ## Read from the file my_startup <- readLines(fcon, warn = FALSE) ## Close the file close(fcon) ## Close the virtual device close(my_device)
Test if an entry (file or directory) exists on a virtual ADF device.
adf_file_exists()
is the equivalent of file.exists()
on a virtual ADF device.
adf_dir_exists()
is the equivalent of dir.exists()
on a virtual ADF device.
adf_file_exists(x, path, ...) ## S3 method for class 'adf_device' adf_file_exists(x, path, ...) ## S3 method for class 'virtual_path' adf_file_exists(x, path, ...) adf_dir_exists(x, path, ...) ## S3 method for class 'adf_device' adf_dir_exists(x, path, ...) ## S3 method for class 'virtual_path' adf_dir_exists(x, path, ...)
adf_file_exists(x, path, ...) ## S3 method for class 'adf_device' adf_file_exists(x, path, ...) ## S3 method for class 'virtual_path' adf_file_exists(x, path, ...) adf_dir_exists(x, path, ...) ## S3 method for class 'adf_device' adf_dir_exists(x, path, ...) ## S3 method for class 'virtual_path' adf_dir_exists(x, path, ...)
x |
Either a virtual device or virtual path. |
path |
A |
... |
Ignored |
adf_file_exists()
returns TRUE
if the path exists on the virtual device, FALSE
otherwise.
adf_dir_exists()
returns TRUE
when the path exists and is a directory, FALSE
otherwise.
Pepijn de Vries
## First setup a connection to a virtual device adz_file <- system.file("example.adz", package = "adfExplorer") my_device <- connect_adf(adz_file) adf_file_exists(my_device, "s/startup-sequence") adf_dir_exists(my_device, "s/startup-sequence") close(my_device)
## First setup a connection to a virtual device adz_file <- system.file("example.adz", package = "adfExplorer") my_device <- connect_adf(adz_file) adf_file_exists(my_device, "s/startup-sequence") adf_dir_exists(my_device, "s/startup-sequence") close(my_device)
Functions documented here are deprecated and will be removed in future
versions of the package. Please use the new functions as indicated instead
or revert to old releases when no alternative is available. See also
vignette("version2")
for more information.
amigaDateToRaw(...) amigaIntToRaw(...) bitmapToRaw(...) displayRawData(...) rawToAmigaDate(...) rawToAmigaInt(...) rawToBitmap(...) adf.disk.name(...) <- value adf.file.mode(...) <- value adf.file.time(...) <- value amigaBlock(...) <- value current.adf.dir(...) <- value adf.disk.name(...) adf.file.exists(...) adf.file.info(...) adf.file.mode(...) adf.file.remove(...) adf.file.size(...) adf.file.time(...) amigaBlock(...) blank.amigaDOSDisk(...) current.adf.dir(...) dir.create.adf(...) dir.exists.adf(...) get.blockID(...) get.diskLocation(...) is.amigaDOS(...) is.bootable(...) list.adf.files(...) put.adf.file(...) read.adf(...) read.adz(...) write.adf(...) write.adz(...)
amigaDateToRaw(...) amigaIntToRaw(...) bitmapToRaw(...) displayRawData(...) rawToAmigaDate(...) rawToAmigaInt(...) rawToBitmap(...) adf.disk.name(...) <- value adf.file.mode(...) <- value adf.file.time(...) <- value amigaBlock(...) <- value current.adf.dir(...) <- value adf.disk.name(...) adf.file.exists(...) adf.file.info(...) adf.file.mode(...) adf.file.remove(...) adf.file.size(...) adf.file.time(...) amigaBlock(...) blank.amigaDOSDisk(...) current.adf.dir(...) dir.create.adf(...) dir.exists.adf(...) get.blockID(...) get.diskLocation(...) is.amigaDOS(...) is.bootable(...) list.adf.files(...) put.adf.file(...) read.adf(...) read.adz(...) write.adf(...) write.adz(...)
... |
Ignored. |
value |
Ignored. |
NULL
The ADZ format is essentially a compressed (gzip) version of the
Amiga Disk File (ADF) format. The adfExplorer
allows you to connect
to both formats. However, you can only open a 'read-only' connection
to ADZ files. Use the compression and decompression functions documented
here to move back and forth from and to ADF and ADZ formats.
compress_adf(source, destination) decompress_adz(source, destination)
compress_adf(source, destination) decompress_adz(source, destination)
source |
Path to the source file to read. |
destination |
Path to the destination file to write. |
Returns NULL
invisibly.
Pepijn de Vries
adz_file <- system.file("example.adz", package = "adfExplorer") adf_file <- tempfile(fileext = ".adf") adz_file2 <- tempfile(fileext = ".adz") decompress_adz(adz_file, adf_file) compress_adf(adf_file, adz_file2)
adz_file <- system.file("example.adz", package = "adfExplorer") adf_file <- tempfile(fileext = ".adf") adz_file2 <- tempfile(fileext = ".adz") decompress_adz(adz_file, adf_file) compress_adf(adf_file, adz_file2)
Establish a connection to a virtual disk stored as Amiga Disk Files (ADF).
You cannot write or read directly from this connection. Instead, use the
methods provided in this package to retrieve information about the virtual
disk or create connections to the files on the disk, to which you can
write and read from (see adf_file_con()
). Like any other connection,
please use close()
to close the connection after use.
connect_adf(filename, write_protected = TRUE)
connect_adf(filename, write_protected = TRUE)
filename |
Filename of the |
write_protected |
A |
Returns an R connection of class adf_device
.
Pepijn de Vries
adz_file <- system.file("example.adz", package = "adfExplorer") my_device <- connect_adf(adz_file) device_capacity(my_device) close(my_device)
adz_file <- system.file("example.adz", package = "adfExplorer") my_device <- connect_adf(adz_file) device_capacity(my_device) close(my_device)
With these functions you can copy or move entries (files and directories) between
a physical and virtual ADF device. With copy_adf_entry()
the files are duplicated,
with move_adf_entry()
the files are moved (and deleted from its source).
copy_adf_entry(source, destination, ...) ## S3 method for class 'character' copy_adf_entry(source, destination, ...) ## S3 method for class 'virtual_path' copy_adf_entry(source, destination, ...) ## S3 method for class 'virtual_path' copy_adf_entry.character(source, destination, ...) ## S3 method for class 'virtual_path' copy_adf_entry.virtual_path(source, destination, ...) ## S3 method for class 'character' copy_adf_entry.virtual_path(source, destination, ...) move_adf_entry(source, destination, ...) ## S3 method for class 'character' move_adf_entry(source, destination, ...) ## S3 method for class 'virtual_path' move_adf_entry(source, destination, ...) ## S3 method for class 'virtual_path' move_adf_entry.character(source, destination, ...) ## S3 method for class 'virtual_path' move_adf_entry.virtual_path(source, destination, ...) ## S3 method for class 'character' move_adf_entry.virtual_path(source, destination, ...)
copy_adf_entry(source, destination, ...) ## S3 method for class 'character' copy_adf_entry(source, destination, ...) ## S3 method for class 'virtual_path' copy_adf_entry(source, destination, ...) ## S3 method for class 'virtual_path' copy_adf_entry.character(source, destination, ...) ## S3 method for class 'virtual_path' copy_adf_entry.virtual_path(source, destination, ...) ## S3 method for class 'character' copy_adf_entry.virtual_path(source, destination, ...) move_adf_entry(source, destination, ...) ## S3 method for class 'character' move_adf_entry(source, destination, ...) ## S3 method for class 'virtual_path' move_adf_entry(source, destination, ...) ## S3 method for class 'virtual_path' move_adf_entry.character(source, destination, ...) ## S3 method for class 'virtual_path' move_adf_entry.virtual_path(source, destination, ...) ## S3 method for class 'character' move_adf_entry.virtual_path(source, destination, ...)
source , destination
|
The |
... |
Ignored |
Pepijn de Vries
## Create an Amiga Disk File ## and prepare a file system on the virtual device my_device <- create_adf_device( tempfile(fileext = ".adf"), write_protected = FALSE) |> prepare_adf_device() ## Copy the packaged R scripts of this package to the virtual device copy_adf_entry( system.file("R", package = "adfExplorer"), virtual_path(my_device, "DF0:") ) ## List all entries on the virtual device list_adf_entries(my_device, recursive = TRUE) ## Move the entire virtual device content to ## the tempdir on your physical device dest <- file.path(tempdir(), "DF0") dir.create(dest) move_adf_entry( virtual_path(my_device, "DF0:"), dest ) ## cleanup the temp directory unlink(dest, recursive = TRUE) close(my_device)
## Create an Amiga Disk File ## and prepare a file system on the virtual device my_device <- create_adf_device( tempfile(fileext = ".adf"), write_protected = FALSE) |> prepare_adf_device() ## Copy the packaged R scripts of this package to the virtual device copy_adf_entry( system.file("R", package = "adfExplorer"), virtual_path(my_device, "DF0:") ) ## List all entries on the virtual device list_adf_entries(my_device, recursive = TRUE) ## Move the entire virtual device content to ## the tempdir on your physical device dest <- file.path(tempdir(), "DF0") dir.create(dest) move_adf_entry( virtual_path(my_device, "DF0:"), dest ) ## cleanup the temp directory unlink(dest, recursive = TRUE) close(my_device)
These functions help you to create an empty virtual device that can be used
in Commodore Amiga emulation. create_adf_device()
simply creates a file
of the proper size (the file size represents the device capacity) and fills it
with raw
zeros. In order to use the device in the Amiga operating system, a
file system needs to be installed on the device. This can be achieved with
prepare_adf_device()
. Note that the file system itself will also consume
disk space on the virtual device.
create_adf_device(destination, type = "DD", ..., connect = TRUE) prepare_adf_device( dev, name = "EMPTY", ffs = TRUE, international = TRUE, dircache = FALSE, bootable = TRUE, ... ) ## S3 method for class 'adf_device' prepare_adf_device( dev, name = "EMPTY", ffs = TRUE, international = TRUE, dircache = FALSE, bootable = TRUE, ... )
create_adf_device(destination, type = "DD", ..., connect = TRUE) prepare_adf_device( dev, name = "EMPTY", ffs = TRUE, international = TRUE, dircache = FALSE, bootable = TRUE, ... ) ## S3 method for class 'adf_device' prepare_adf_device( dev, name = "EMPTY", ffs = TRUE, international = TRUE, dircache = FALSE, bootable = TRUE, ... )
destination |
File path where the virtual device needs to be stored. |
type |
Specify the type of virtual device you wish to create.
Should be one of |
... |
Ignored for |
connect |
A |
dev |
The virtual adf device for which information needs to be obtained.
It should be of class |
name |
A |
ffs |
A |
international |
A |
dircache |
A |
bootable |
A If set to |
Either an adf_device
connection or NULL
depending on the value of
connect
.
Pepijn de Vries
## Filepath to store the virtual device: dest <- tempfile(fileext = ".adf") ## Create a blank unformated virtual device (a double density floppy disk): my_device <- create_adf_device(dest, "DD", connect = TRUE, write_protected = FALSE) print(my_device) ## Format the floppy and create a file system on the device: prepare_adf_device(my_device, name = "foobar") print(my_device) ## don't forget to close the device connection after use: close(my_device)
## Filepath to store the virtual device: dest <- tempfile(fileext = ".adf") ## Create a blank unformated virtual device (a double density floppy disk): my_device <- create_adf_device(dest, "DD", connect = TRUE, write_protected = FALSE) print(my_device) ## Format the floppy and create a file system on the device: prepare_adf_device(my_device, name = "foobar") print(my_device) ## don't forget to close the device connection after use: close(my_device)
adf_device
connectionA collection of functions to retrieve information about the virtual device, or any volume (file system) available on the device. See examples for usage and results.
device_type(dev, ...) ## S3 method for class 'adf_device' device_type(dev, ...) device_capacity(dev, ...) ## S3 method for class 'adf_device' device_capacity(dev, ...) volume_capacity(dev, ...) ## S3 method for class 'adf_device' volume_capacity(dev, vol = 0L, ...) volume_name(dev, ...) volume_name(dev, ...) <- value ## S3 method for class 'adf_device' volume_name(dev, vol = 0L, ...) ## S3 replacement method for class 'adf_device' volume_name(dev, vol = 0L, ...) <- value n_volumes(dev, ...) ## S3 method for class 'adf_device' n_volumes(dev, ...) bytes_free(dev, ...) ## S3 method for class 'adf_device' bytes_free(dev, vol = 0L, ...) is_bootable(dev, ...) ## S3 method for class 'adf_device' is_bootable(dev, vol = 0L, ...) is_fast_file_system(dev, ...) ## S3 method for class 'adf_device' is_fast_file_system(dev, vol = 0L, ...) is_international(dev, ...) ## S3 method for class 'adf_device' is_international(dev, vol = 0L, ...) is_dircache(dev, ...) ## S3 method for class 'adf_device' is_dircache(dev, vol = 0L, ...) is_write_protected(dev, ...) ## S3 method for class 'adf_device' is_write_protected(dev, ...)
device_type(dev, ...) ## S3 method for class 'adf_device' device_type(dev, ...) device_capacity(dev, ...) ## S3 method for class 'adf_device' device_capacity(dev, ...) volume_capacity(dev, ...) ## S3 method for class 'adf_device' volume_capacity(dev, vol = 0L, ...) volume_name(dev, ...) volume_name(dev, ...) <- value ## S3 method for class 'adf_device' volume_name(dev, vol = 0L, ...) ## S3 replacement method for class 'adf_device' volume_name(dev, vol = 0L, ...) <- value n_volumes(dev, ...) ## S3 method for class 'adf_device' n_volumes(dev, ...) bytes_free(dev, ...) ## S3 method for class 'adf_device' bytes_free(dev, vol = 0L, ...) is_bootable(dev, ...) ## S3 method for class 'adf_device' is_bootable(dev, vol = 0L, ...) is_fast_file_system(dev, ...) ## S3 method for class 'adf_device' is_fast_file_system(dev, vol = 0L, ...) is_international(dev, ...) ## S3 method for class 'adf_device' is_international(dev, vol = 0L, ...) is_dircache(dev, ...) ## S3 method for class 'adf_device' is_dircache(dev, vol = 0L, ...) is_write_protected(dev, ...) ## S3 method for class 'adf_device' is_write_protected(dev, ...)
dev |
The virtual adf device for which information needs to be obtained.
It should be of class |
... |
Ignored |
vol |
Volume index number on the device starting at |
value |
Replacement value. In case of |
Returns the requested information, or an updated copy of dev
in case
of an assign operation (<-
).
Pepijn de Vries
## 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 = "adfExplorer"), adf_file) ## Open virtual device to demonstrate methods my_device <- connect_adf(adf_file, write_protected = FALSE) device_type(my_device) device_capacity(my_device) # in bytes volume_capacity(my_device) # in bytes n_volumes(my_device) # number of volumes available on device volume_name(my_device) # name of the volume volume_name(my_device) <- "new_name" # rename the volume bytes_free(my_device) # bytes available for writing is_bootable(my_device) # tests if device is potentially bootable is_fast_file_system(my_device) # tests if volume uses FFS is_international(my_device) # tests if file system uses intl mode is_dircache(my_device) # tests if file system uses dir caching is_write_protected(my_device) # tests if device is protected against writing close(my_device)
## 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 = "adfExplorer"), adf_file) ## Open virtual device to demonstrate methods my_device <- connect_adf(adf_file, write_protected = FALSE) device_type(my_device) device_capacity(my_device) # in bytes volume_capacity(my_device) # in bytes n_volumes(my_device) # number of volumes available on device volume_name(my_device) # name of the volume volume_name(my_device) <- "new_name" # rename the volume bytes_free(my_device) # bytes available for writing is_bootable(my_device) # tests if device is potentially bootable is_fast_file_system(my_device) # tests if volume uses FFS is_international(my_device) # tests if file system uses intl mode is_dircache(my_device) # tests if file system uses dir caching is_write_protected(my_device) # tests if device is protected against writing close(my_device)
Format and print methods for all S3 class objects created with adfExplorer
## S3 method for class 'adf_device' format(x, ...) ## S3 method for class 'adf_file_con' format(x, ...) ## S3 method for class 'adf_block' format(x, ...) ## S3 method for class 'virtual_path' format(x, width = 20L, ...) ## S3 method for class 'adf_device' print(x, ...) ## S3 method for class 'adf_file_con' print(x, ...) ## S3 method for class 'adf_block' print(x, ...) ## S3 method for class 'virtual_path' print(x, ...) ## S3 method for class 'virtual_path' as.character(x, ...)
## S3 method for class 'adf_device' format(x, ...) ## S3 method for class 'adf_file_con' format(x, ...) ## S3 method for class 'adf_block' format(x, ...) ## S3 method for class 'virtual_path' format(x, width = 20L, ...) ## S3 method for class 'adf_device' print(x, ...) ## S3 method for class 'adf_file_con' print(x, ...) ## S3 method for class 'adf_block' print(x, ...) ## S3 method for class 'virtual_path' print(x, ...) ## S3 method for class 'virtual_path' as.character(x, ...)
x |
Object to be formatted or printed |
... |
Ignored or passed on to next methods |
width |
Set the text width for formatting virtual paths |
Get an overview of all entries (files and directories) in a specific directory.
list_adf_entries(x, path, recursive = FALSE, nested = FALSE, ...) ## S3 method for class 'adf_device' list_adf_entries(x, path, recursive = FALSE, nested = FALSE, ...) ## S3 method for class 'virtual_path' list_adf_entries(x, path, recursive = FALSE, nested = FALSE, ...) ## S3 method for class 'character' list_adf_entries.adf_device(x, path, recursive = FALSE, nested = FALSE, ...) ## S3 method for class 'virtual_path' list_adf_entries.adf_device(x, path, recursive = FALSE, ...)
list_adf_entries(x, path, recursive = FALSE, nested = FALSE, ...) ## S3 method for class 'adf_device' list_adf_entries(x, path, recursive = FALSE, nested = FALSE, ...) ## S3 method for class 'virtual_path' list_adf_entries(x, path, recursive = FALSE, nested = FALSE, ...) ## S3 method for class 'character' list_adf_entries.adf_device(x, path, recursive = FALSE, nested = FALSE, ...) ## S3 method for class 'virtual_path' list_adf_entries.adf_device(x, path, recursive = FALSE, ...)
x |
Either an |
path |
The virtual path for which you wish to obtain a list
of entries (see also |
recursive |
A |
nested |
A |
... |
Ignored |
A vector of virtual_path
class objects, or a nested list
in
case nested
is TRUE
.
Pepijn de Vries
## First setup a connection to a virtual device adz_file <- system.file("example.adz", package = "adfExplorer") my_device <- connect_adf(adz_file) ## List all entries in the disk's root: list_adf_entries(my_device) ## List all entries on the disk: list_adf_entries(my_device, recursive = TRUE) close(my_device)
## First setup a connection to a virtual device adz_file <- system.file("example.adz", package = "adfExplorer") my_device <- connect_adf(adz_file) ## List all entries in the disk's root: list_adf_entries(my_device) ## List all entries on the disk: list_adf_entries(my_device, recursive = TRUE) close(my_device)
The Amiga file system is structured around 512 byte blocks. A double density
floppy disk consists of 1760 blocks of 512 bytes. read_adf_block
and write_adf_block
can be used to transform raw data from and to virtual devices (created with
create_adf_device()
or connect_adf()
). Note that writing raw data to
a disk could corrupt the file system on the device. So it is generally not
advised unless you know what you are doing.
read_adf_block(dev, sector, ...) ## S3 method for class 'adf_device' read_adf_block(dev, sector, ...) write_adf_block(dev, sector, data, ...) ## S3 method for class 'adf_device' write_adf_block(dev, sector, data, ...) ## S3 method for class 'raw' write_adf_block.adf_device(dev, sector, data, ...) ## S3 method for class 'adf_block' write_adf_block.adf_device(dev, sector, data, ...) ## Default S3 method: write_adf_block.adf_device(dev, sector, data, ...) as_adf_block(data, ...) new_adf_block()
read_adf_block(dev, sector, ...) ## S3 method for class 'adf_device' read_adf_block(dev, sector, ...) write_adf_block(dev, sector, data, ...) ## S3 method for class 'adf_device' write_adf_block(dev, sector, data, ...) ## S3 method for class 'raw' write_adf_block.adf_device(dev, sector, data, ...) ## S3 method for class 'adf_block' write_adf_block.adf_device(dev, sector, data, ...) ## Default S3 method: write_adf_block.adf_device(dev, sector, data, ...) as_adf_block(data, ...) new_adf_block()
dev |
The virtual adf device for which information needs to be obtained.
It should be of class |
sector |
Sector ID of the block you wish to read/write. It is an integer value. For double density disks, the ID ranges from 0 to 1759. |
... |
Ignored |
data |
Block data ( |
In case of write_adf_block
NULL
is returned invisibly. In case of read_adf_block
the raw
data is returned as a adf_block
class object.
Pepijn de Vries
These methods mask the identical functions in the base
package (see base::readBin()
,
base::readLines()
, base::readChar()
, base::writeBin()
, base::writeLines()
and
base::writeChar()
. They behave exactly the
same as their base counterpart, with the exception that they can read and write to connections
opened with adf_file_con()
.
readBin( con, what, n = 1L, size = NA_integer_, signed = TRUE, endian = .Platform$endian ) ## Default S3 method: readBin( con, what, n = 1L, size = NA_integer_, signed = TRUE, endian = .Platform$endian ) ## S3 method for class 'adf_file_con' readBin( con, what, n = 1L, size = NA_integer_, signed = TRUE, endian = .Platform$endian ) readLines( con, n = -1L, ok = TRUE, warn = TRUE, encoding = "unknown", skipNul = FALSE ) ## Default S3 method: readLines( con = stdin(), n = -1L, ok = TRUE, warn = TRUE, encoding = "unknown", skipNul = FALSE ) ## S3 method for class 'adf_file_con' readLines( con, n = -1L, ok = TRUE, warn = TRUE, encoding = "unknown", skipNul = FALSE ) writeBin( object, con, size = NA_integer_, endian = .Platform$endian, useBytes = FALSE ) ## Default S3 method: writeBin( object, con, size = NA_integer_, endian = .Platform$endian, useBytes = FALSE ) ## S3 method for class 'adf_file_con' writeBin( object, con, size = NA_integer_, endian = .Platform$endian, useBytes = FALSE ) writeLines(text, con, sep = "\n", useBytes = FALSE) ## Default S3 method: writeLines(text, con = stdout(), sep = "\n", useBytes = FALSE) ## S3 method for class 'adf_file_con' writeLines(text, con = stdout(), sep = "\n", useBytes = FALSE)
readBin( con, what, n = 1L, size = NA_integer_, signed = TRUE, endian = .Platform$endian ) ## Default S3 method: readBin( con, what, n = 1L, size = NA_integer_, signed = TRUE, endian = .Platform$endian ) ## S3 method for class 'adf_file_con' readBin( con, what, n = 1L, size = NA_integer_, signed = TRUE, endian = .Platform$endian ) readLines( con, n = -1L, ok = TRUE, warn = TRUE, encoding = "unknown", skipNul = FALSE ) ## Default S3 method: readLines( con = stdin(), n = -1L, ok = TRUE, warn = TRUE, encoding = "unknown", skipNul = FALSE ) ## S3 method for class 'adf_file_con' readLines( con, n = -1L, ok = TRUE, warn = TRUE, encoding = "unknown", skipNul = FALSE ) writeBin( object, con, size = NA_integer_, endian = .Platform$endian, useBytes = FALSE ) ## Default S3 method: writeBin( object, con, size = NA_integer_, endian = .Platform$endian, useBytes = FALSE ) ## S3 method for class 'adf_file_con' writeBin( object, con, size = NA_integer_, endian = .Platform$endian, useBytes = FALSE ) writeLines(text, con, sep = "\n", useBytes = FALSE) ## Default S3 method: writeLines(text, con = stdout(), sep = "\n", useBytes = FALSE) ## S3 method for class 'adf_file_con' writeLines(text, con = stdout(), sep = "\n", useBytes = FALSE)
con |
A connection to a file on a virtual ADF device. Such a connection can
be established with |
what |
Either an object whose mode will give the mode of the
vector to be read, or a character vector of length one describing
the mode: one of |
n |
numeric. The (maximal) number of records to be
read. You can use an over-estimate here, but not too large as
storage is reserved for |
size |
integer. The number of bytes per element in the byte
stream. The default, |
signed |
logical. Only used for integers of sizes 1 and 2, when it determines if the quantity on file should be regarded as a signed or unsigned integer. |
endian |
The endian-ness ( |
ok |
logical. Is it OK to reach the end of the connection before
|
warn |
logical. Warn if a text file is missing a final EOL or if there are embedded nuls in the file. |
encoding |
encoding to be assumed for input strings. It is
used to mark character strings as known to be in
Latin-1, UTF-8 or to be bytes: it is not used to re-encode the input.
To do the
latter, specify the encoding as part of the connection |
skipNul |
logical: should nuls be skipped? |
object |
An R object to be written to the connection. |
useBytes |
See |
text |
A character vector |
sep |
character string. A string to be written to the connection after each line of text. |
Returns NULL
invisibly
This function removes an entry (file or directory) from a virtual ADF device. At the moment this function only removes a single entry per call, and in case the entry is a directory, the directory needs to be empty before it can be removed.
remove_adf_entry(x, path, flush = FALSE, ...) ## S3 method for class 'adf_device' remove_adf_entry(x, path, flush = FALSE, ...) ## S3 method for class 'virtual_path' remove_adf_entry(x, path, flush = FALSE, ...) ## S3 method for class 'character' remove_adf_entry.adf_device(x, path, flush = FALSE, ...) ## S3 method for class 'virtual_path' remove_adf_entry.adf_device(x, path, flush = FALSE, ...)
remove_adf_entry(x, path, flush = FALSE, ...) ## S3 method for class 'adf_device' remove_adf_entry(x, path, flush = FALSE, ...) ## S3 method for class 'virtual_path' remove_adf_entry(x, path, flush = FALSE, ...) ## S3 method for class 'character' remove_adf_entry.adf_device(x, path, flush = FALSE, ...) ## S3 method for class 'virtual_path' remove_adf_entry.adf_device(x, path, flush = FALSE, ...)
x |
The virtual ADF device from which an entry needs to be deleted or a virtual path pointing
at the entry to be deleted. In case of a virtual device, it should be of class |
path |
A |
flush |
A |
... |
Ignored |
Returns the device connection
Pepijn de Vries
## We first need a writable connection to an ADF device. ## For this purpose we decompress the ADZ file that comes ## with this package and open a connection adz_file <- system.file("example.adz", package = "adfExplorer") adf_file <- tempfile(fileext = ".adf") decompress_adz(adz_file, adf_file) my_device <- connect_adf(adf_file, write_protected = FALSE) ## List files in directory 'Devs': list_adf_entries(my_device, "Devs") ## remove the file 'system-configuration' from the virtual device remove_adf_entry(my_device, "devs/system-configuration") ## List files in directory 'Devs' again: list_adf_entries(my_device, "Devs") ## close the connection to the virtual device close(my_device)
## We first need a writable connection to an ADF device. ## For this purpose we decompress the ADZ file that comes ## with this package and open a connection adz_file <- system.file("example.adz", package = "adfExplorer") adf_file <- tempfile(fileext = ".adf") decompress_adz(adz_file, adf_file) my_device <- connect_adf(adf_file, write_protected = FALSE) ## List files in directory 'Devs': list_adf_entries(my_device, "Devs") ## remove the file 'system-configuration' from the virtual device remove_adf_entry(my_device, "devs/system-configuration") ## List files in directory 'Devs' again: list_adf_entries(my_device, "Devs") ## close the connection to the virtual device close(my_device)
This function creates a path pointing to a file or directory
on a virtual ADF device (created with connect_adf()
or create_adf_device()
).
The virtual path created with this function can be used to establish a readable
or writable connection to a file, or obtain information about a file or directory.
See also vignette("virtual_paths")
virtual_path(dev, path)
virtual_path(dev, path)
dev |
A virtual ADF device (created with |
path |
A |
Returns a virtual_path
class object.
Pepijn de Vries
adz_file <- system.file("example.adz", package = "adfExplorer") # Open a connection to a virtual device: my_device <- connect_adf(adz_file) # specify a virtual path: my_path <- virtual_path(my_device, "DF0:s/startup-sequence") # close the virtual device: close(my_device)
adz_file <- system.file("example.adz", package = "adfExplorer") # Open a connection to a virtual device: my_device <- connect_adf(adz_file) # specify a virtual path: my_path <- virtual_path(my_device, "DF0:s/startup-sequence") # close the virtual device: close(my_device)