Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: adfExplorer
Title: Access and Manipulate Amiga Disk Files
Version: 2.0.3.0006
Version: 2.0.3.0007
Authors@R:
c(
person("Pepijn", "de Vries", role = c("aut", "cre"),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
adfExplorer 2.0.3.0006
adfExplorer 2.0.3.0007
-------------

* Added `get_adf_bitmap()`, `adf_dumpster_dive()` and
Expand Down
6 changes: 5 additions & 1 deletion src/undelete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ SEXP undelete_adf_entry(SEXP extptr, int vol_num, int sect) {
check_volume_number(dev, vol_num);
AdfVolume * vol = dev->volList[vol_num];

RETCODE rc = adfUndelEntry(vol, dest_sect, sect);
RETCODE rc;

rc = adfCheckEntry(vol, sect, 0);
if (rc == RC_OK)
rc = adfUndelEntry(vol, dest_sect, sect);

if (rc != RC_OK) stop("Failed to salvage entry");

Expand Down
7 changes: 5 additions & 2 deletions tests/testthat/test_directory.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ test_that("File existence can be tested for multiple directories", {
})
})

test_that("A new directory can be created using a virtual path", {
test_that("A new directory can be created using a virtual path or a character", {
expect_no_error({
my_device <- demo_adf(write_protected = FALSE)
target <- virtual_path(my_device, "foobar")
make_adf_dir(my_device, target)
target2 <- virtual_path(my_device, "raboof")
make_adf_dir(target)
make_adf_dir(my_device, target2)
make_adf_dir(my_device, "barfoo")
close(my_device)
})
})
1 change: 1 addition & 0 deletions tests/testthat/test_entryinfo.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ test_that("Entries can be listed", {
entries <- list_adf_entries(my_device)
entries <- list_adf_entries(my_device, "s")
entries <- list_adf_entries(my_device, virtual_path(my_device, "devs"))
entries <- list_adf_entries(virtual_path(my_device, "devs"))
close(my_device)
})
})
26 changes: 24 additions & 2 deletions tests/testthat/test_move.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,19 @@ test_that("Copy vp to character works", {
my_device <- demo_adf()
vp <- virtual_path(my_device, "s/startup-sequence")
check_dest <- file.path(tempdir(), adf_entry_name(vp))
if (!file.exists(check_dest))
copy_adf_entry(vp, tempdir())
copy_adf_entry(vp, tempdir())
close(my_device)
rem <- file.remove(file.path(tempdir(), "startup-sequence"))
})
})

test_that("Copy character to vp works", {
expect_no_error({
my_device <- demo_adf(write_protected = FALSE)
f <- tempfile()
file.create(f)
vp <- virtual_path(my_device, "DF0:")
copy_adf_entry(f, vp)
close(my_device)
})
})
Expand All @@ -39,3 +50,14 @@ test_that("Move vp to vp works", {
close(my_device)
})
})

test_that("Move vp to character works", {
expect_no_error({
my_device <- demo_adf(write_protected = FALSE)
vp <- virtual_path(my_device, "s/startup-sequence")
f <- tempdir()
move_adf_entry(vp, f)
close(my_device)
rem <- file.remove(file.path(tempdir(), "startup-sequence"))
})
})
12 changes: 12 additions & 0 deletions tests/testthat/test_remove.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
test_that("File can be removed from dircache disk", {
expect_no_error({
my_device <- create_adf_device(tempfile(fileext = ".adf"), write_protected = FALSE)
prepare_adf_device(my_device, "foobar", dircache = TRUE)
con <- adf_file_con(virtual_path(my_device, "dummy"), writable = TRUE)
writeBin(raw(100), con)
close(con)
remove_adf_entry(my_device, "dummy")
close(my_device)
})
})

test_that("Current directory can be removed", {
expect_no_error({
my_device <- demo_adf(write_protected = FALSE)
Expand Down
Loading