Skip to content

Commit

Permalink
only write backup if writing to files
Browse files Browse the repository at this point in the history
  • Loading branch information
philipdelff committed Dec 8, 2024
1 parent 885da6b commit 07a2081
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: NMdata
Type: Package
Title: Preparation, Checking and Post-Processing Data for PK/PD Modeling
Version: 0.1.8.904
Version: 0.1.8.905
Authors@R:
c(person(given="Philip", family="Delff",
email = "philip@delff.dk",
Expand Down
2 changes: 1 addition & 1 deletion R/NMwriteSection.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
##' exactly match the one in `$DATA` or `$INFILE` in Nonmem.
##' @param write Default is to write to file. If write=FALSE,
##' `NMwriteSection()` returns the resulting input.txt without writing
##' it to disk? Default is `FALSE`.
##' it to disk. Default is `TRUE`.
##' @param quiet The default is to give some information along the way
##' on what data is found. But consider setting this to TRUE for
##' non-interactive use. Default can be configured using
Expand Down
2 changes: 1 addition & 1 deletion R/NMwriteSectionOne.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ NMwriteSectionOne <- function(file0,lines,section,location=c("replace","before",

if(is.null(newfile)) return(newlines)

if(file0==newfile && backup ) {
if(write && file0==newfile && backup ) {
dir.backup <- file.path(dirname(file0),"NMdata_backup")
## make sure backup dir exists
if(file.exists(dir.backup)&&!dir.exists(dir.backup)) messageWrap("Something called NMdata_backup is found and it is not a directory. Please remove or use backup=FALSE.",fun.msg=stop)
Expand Down

0 comments on commit 07a2081

Please sign in to comment.