Skip to content

Commit

Permalink
Merge pull request #103 from kbroman/master
Browse files Browse the repository at this point in the history
Fix zip_datafiles() re subdirectories
  • Loading branch information
kbroman authored Feb 16, 2019
2 parents 393b00f + a790212 commit 29b0fbe
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: qtl2
Version: 0.18
Date: 2019-02-08
Version: 0.19-1
Date: 2019-02-16
Title: Quantitative Trait Locus Mapping in Experimental Crosses
Description: R/qtl2 provides a set of tools to perform quantitative
trait locus (QTL) analysis in experimental crosses. It is a
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## qtl2 0.19-1 (2019-02-16)

### Bug fixes

- Fix bug in `zip_datafiles()` when the files are in a subdirectory.
(See [Issue #102](https://github.com/rqtl/qtl2/issues/102).)


## qtl2 0.18 (2019-02-08)

### New features
Expand Down
15 changes: 12 additions & 3 deletions R/zip_datafiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ function(control_file, zip_file=NULL, overwrite=FALSE, quiet=TRUE)

dir <- dirname(control_file)

if(is.null(zip_file))
zip_file <- sub("\\.[a-z]+$", ".zip", control_file)
move_zip_file <- TRUE
if(is.null(zip_file)) {
zip_file <- sub("\\.[a-z]+$", ".zip", basename(control_file))
move_zip_file <- FALSE
}

# read control file
control <- read_control_file(control_file)
Expand Down Expand Up @@ -96,7 +99,13 @@ function(control_file, zip_file=NULL, overwrite=FALSE, quiet=TRUE)
}

# do the zipping
utils::zip(zip_file, files, flags=zip_flags)
utils::zip(basename(zip_file), files, flags=zip_flags)

# if not being zipped into the data file directory, move it
if(move_zip_file) {
setwd(cwd)
file.rename(file.path(dir, basename(zip_file)), zip_file)
}

invisible(zip_file)
}

0 comments on commit 29b0fbe

Please sign in to comment.