[rkward-cvs] SF.net SVN: rkward:[4405] trunk/rkward/rkward/rbackend/rpackages/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Oct 31 14:28:27 UTC 2012


Revision: 4405
          http://rkward.svn.sourceforge.net/rkward/?rev=4405&view=rev
Author:   tfry
Date:     2012-10-31 14:28:27 +0000 (Wed, 31 Oct 2012)
Log Message:
-----------
Alwayxs ask whether to flush output file (by default, can be overridden)

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R
    trunk/rkward/rkward/rbackend/rpackages/rkward/man/rk.get.tempfile.name.Rd

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R	2012-10-31 12:14:49 UTC (rev 4404)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.filename-functions.R	2012-10-31 14:28:27 UTC (rev 4405)
@@ -29,6 +29,7 @@
 #' @param additional.header.contents NULL or an additional string to add to the HTML header section.
 #'        This could be scripts or additional CSS definitions, for example. Note that
 #'        @em nothing will be added to the header, if the file already exists.
+#' @param ask Logical: Whether to ask before flushing the output file.
 #' @return \code{rk.get.tempfile.name}, \code{rk.get.output.html.file}, and
 #'   \code{rk.get.workspace.url} return a string while
 #'   \code{rk.set.output.html.file} returns \code{NULL}.
@@ -161,7 +162,10 @@
 
 #' @export
 #' @rdname rk.get.tempfile.name
-"rk.flush.output" <- function (x=rk.get.output.html.file ()) {
-   unlink (file)
-   rk.set.output.html.file (file)
+"rk.flush.output" <- function (x=rk.get.output.html.file (), ask=TRUE) {
+	if (isTRUE (ask)) {
+		if (!rk.show.question (paste ("Do you really want to flush the output file (", x, ")?\nIt will not be possible to restore it."))) stop ("Aborted by user")
+	}
+	unlink (x)
+	rk.set.output.html.file (x)
 }

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/man/rk.get.tempfile.name.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/man/rk.get.tempfile.name.Rd	2012-10-31 12:14:49 UTC (rev 4404)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/man/rk.get.tempfile.name.Rd	2012-10-31 14:28:27 UTC (rev 4405)
@@ -16,7 +16,8 @@
   rk.set.output.html.file(x,
     additional.header.contents = getOption("rk.html.header.additions"))
 
-  rk.flush.output(x = rk.get.output.html.file())
+  rk.flush.output(x = rk.get.output.html.file(),
+    ask = TRUE)
 }
 \arguments{
   \item{prefix}{a string, used as a filename prefix when
@@ -32,6 +33,9 @@
   string to add to the HTML header section.  This could be
   scripts or additional CSS definitions, for example. Note
   that}
+
+  \item{ask}{Logical: Whether to ask before flushing the
+  output file.}
 }
 \value{
   \code{rk.get.tempfile.name},

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the rkward-tracker mailing list