Skip to content

Commit 6131a63

Browse files
committed
Delete temp files
Fixes #77
1 parent 3cf9161 commit 6131a63

7 files changed

Lines changed: 13 additions & 0 deletions

File tree

RcppTskit/R/Class-TableCollection.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ TableCollection <- R6Class(
6565
#' dump_file <- tempfile()
6666
#' tc$dump(dump_file)
6767
#' tc$write(dump_file) # alias
68+
#' \dontshow{file.remove(dump_file)}
6869
dump = function(file) {
6970
tc_ptr_dump(self$pointer, file = file, options = 0L)
7071
},

RcppTskit/R/Class-TreeSequence.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ TreeSequence <- R6Class(
7171
#' dump_file <- tempfile()
7272
#' ts$dump(dump_file)
7373
#' ts$write(dump_file) # alias
74+
#' \dontshow{file.remove(dump_file)}
7475
dump = function(file) {
7576
ts_ptr_dump(self$pointer, file = file, options = 0L)
7677
},

RcppTskit/man/TableCollection.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RcppTskit/man/TreeSequence.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RcppTskit/src/RcppTskit.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ SEXP tc_ptr_load(const std::string file, const int options = 0) {
225225
// ts_ptr <- RcppTskit:::ts_ptr_load(ts_file)
226226
// dump_file <- tempfile()
227227
// RcppTskit:::ts_ptr_dump(ts_ptr, dump_file)
228+
// file.remove(dump_file)
228229
// [[Rcpp::export]]
229230
void ts_ptr_dump(const SEXP ts, const std::string file, const int options = 0) {
230231
const tsk_flags_t dump_options =
@@ -250,6 +251,7 @@ void ts_ptr_dump(const SEXP ts, const std::string file, const int options = 0) {
250251
// tc_ptr <- RcppTskit:::tc_ptr_load(ts_file)
251252
// dump_file <- tempfile()
252253
// RcppTskit:::tc_ptr_dump(tc_ptr, dump_file)
254+
// file.remove(dump_file)
253255
// [[Rcpp::export]]
254256
void tc_ptr_dump(const SEXP tc, const std::string file, const int options = 0) {
255257
const tsk_flags_t dump_options =

RcppTskit/tests/testthat/test_load_summary_and_dump.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ test_that("ts/tc_load(), ts/tc_summary*(), and ts/tc_dump(x) work", {
390390
ts_ptr_dump(ts_ptr, dump_file)
391391
rm(ts_ptr)
392392
ts_ptr <- ts_ptr_load(dump_file)
393+
file.remove(dump_file)
393394

394395
# Simple comparison of summaries
395396
n <- ts_ptr_summary(ts_ptr)
@@ -438,6 +439,7 @@ test_that("ts/tc_load(), ts/tc_summary*(), and ts/tc_dump(x) work", {
438439
rm(tc_ptr)
439440
tc_ptr <- tc_ptr_load(dump_file)
440441
ts_ptr <- ts_ptr_load(dump_file)
442+
file.remove(dump_file)
441443

442444
# Simple comparison of summaries
443445
n_ts <- ts_ptr_summary(ts_ptr)
@@ -474,6 +476,7 @@ test_that("ts/tc_load(), ts/tc_summary*(), and ts/tc_dump(x) work", {
474476
ts$dump(dump_file)
475477
rm(ts)
476478
ts <- ts_load(dump_file)
479+
file.remove(dump_file)
477480

478481
# Simple comparison of summaries
479482
n_ptr <- ts_ptr_summary(ts$pointer)
@@ -515,6 +518,7 @@ test_that("ts/tc_load(), ts/tc_summary*(), and ts/tc_dump(x) work", {
515518
tc$dump(dump_file)
516519
rm(tc)
517520
tc <- tc_load(dump_file)
521+
file.remove(dump_file)
518522

519523
# Simple comparison of summaries
520524
n_ptr <- tc_ptr_summary(tc$pointer)

RcppTskit/vignettes/RcppTskit_intro.qmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ ts$dump(file = ts_file)
276276
# ... and to bring it back to R, use ...
277277
ts2 <- ts_load(ts_file)
278278
ts$num_individuals() # 2 (if you have run the above Python code)
279+
file.remove(ts_file)
279280
280281
# You can work similarly with table collection between R & Python
281282
tc <- ts$dump_tables()

0 commit comments

Comments
 (0)