From: <li...@us...> - 2009-02-02 14:31:06
|
Revision: 99 http://bugs-r.svn.sourceforge.net/bugs-r/?rev=99&view=rev Author: ligges Date: 2009-02-02 14:30:50 +0000 (Mon, 02 Feb 2009) Log Message: ----------- yet another working directory issue Modified Paths: -------------- trunk/R2WinBUGS/DESCRIPTION trunk/R2WinBUGS/R/bugs.R trunk/R2WinBUGS/inst/NEWS Modified: trunk/R2WinBUGS/DESCRIPTION =================================================================== --- trunk/R2WinBUGS/DESCRIPTION 2009-01-20 17:17:55 UTC (rev 98) +++ trunk/R2WinBUGS/DESCRIPTION 2009-02-02 14:30:50 UTC (rev 99) @@ -1,7 +1,7 @@ Package: R2WinBUGS Title: Running WinBUGS and OpenBUGS from R / S-PLUS -Date: 2009-01-20 -Version: 2.1-10 +Date: 2009-02-02 +Version: 2.1-11 Author: originally written by Andrew Gelman <ge...@st...>; changes and packaged by Sibylle Sturtz <st...@st...> and Uwe Ligges <li...@st...>. Modified: trunk/R2WinBUGS/R/bugs.R =================================================================== --- trunk/R2WinBUGS/R/bugs.R 2009-01-20 17:17:55 UTC (rev 98) +++ trunk/R2WinBUGS/R/bugs.R 2009-02-02 14:30:50 UTC (rev 99) @@ -42,6 +42,7 @@ } ## Move to working drirectory or temporary directory when NULL + inTempDir <- FALSE if(is.null(working.directory)) { working.directory <- tempdir() if(useWINE){ @@ -53,6 +54,7 @@ savedWD <- getwd() setwd(working.directory) on.exit(setwd(savedWD), add = TRUE) + inTempDir <- TRUE } ## model.file is not a file name but a model function @@ -68,6 +70,8 @@ model.file <- gsub("\\\\", "/", temp) if(!is.R()) on.exit(file.remove(model.file), add=TRUE) } + if(inTempDir && basename(model.file) == model.file) + try(file.copy(file.path(savedWD, model.file), model.file, overwrite = TRUE)) if(!file.exists(model.file)) stop(paste(model.file, "does not exist.")) if(file.info(model.file)$isdir) @@ -76,13 +80,16 @@ (regexpr("\\.txt$", data) > 0))) { bugs.data.file <- bugs.data(data, dir = getwd(), digits) } else { + if(inTempDir && basename(data) == data) + try(file.copy(file.path(savedWD, data), data, overwrite = TRUE)) if(!file.exists(data)) stop("File", data, "does not exist.") bugs.data.file <- data } - if (is.character(inits)) { + if(inTempDir && all(basename(inits) == inits)) + try(file.copy(file.path(savedWD, inits), inits, overwrite = TRUE)) if (!all(file.exists(inits))) { stop("One or more inits files are missing") } Modified: trunk/R2WinBUGS/inst/NEWS =================================================================== --- trunk/R2WinBUGS/inst/NEWS 2009-01-20 17:17:55 UTC (rev 98) +++ trunk/R2WinBUGS/inst/NEWS 2009-02-02 14:30:50 UTC (rev 99) @@ -1,6 +1,11 @@ Changes to R2WinBUGS: ===================== +Update 2.1-11 +- bugfix: if working.directory was unset and files are assumed to be in R's + former wd, these are copied to the tempdir that is set as new working + directory now. + Update 2.1-10 - bugfix: working.directory was not always reset when function terminated. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |