[codeface] [PATCH 1/6] Move gen.dir to a central location

  • From: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
  • To: <codeface@xxxxxxxxxxxxx>
  • Date: Sat, 21 Nov 2015 21:45:55 +0100

Creating directories that do not yet exist is also
useful outside mailing list analysis.

Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
---
codeface/R/ml/batch.r | 1 +
codeface/R/ml/ml_utils.r | 8 --------
codeface/R/utils.r | 8 ++++++++
3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/codeface/R/ml/batch.r b/codeface/R/ml/batch.r
index 13be692..fe66f53 100755
--- a/codeface/R/ml/batch.r
+++ b/codeface/R/ml/batch.r
@@ -23,6 +23,7 @@ s <- suppressPackageStartupMessages
source("../config.r", chdir=TRUE)
source("../db.r", chdir=TRUE)
source("../mc_helpers.r", chdir=TRUE)
+source("../utils.r", chdir=TRUE)
source("ml_utils.r")
s(source("analysis.r"))
s(source("project.spec.r"))
diff --git a/codeface/R/ml/ml_utils.r b/codeface/R/ml/ml_utils.r
index 963cd2d..a733972 100644
--- a/codeface/R/ml/ml_utils.r
+++ b/codeface/R/ml/ml_utils.r
@@ -23,14 +23,6 @@ source.files <- function(path) {
}
}

-## Create a directory if it does not yet exist
-gen.dir <- function(dir) {
- if (!file_test("-d", dir)) {
- if (!dir.create(dir, recursive=TRUE)) {
- stop("Cannot create directory ", dir)
- }
- }
-}


## Initially based on snatm code, albeit only the basic outline has
diff --git a/codeface/R/utils.r b/codeface/R/utils.r
index 9911497..5ea7cd0 100644
--- a/codeface/R/utils.r
+++ b/codeface/R/utils.r
@@ -100,3 +100,11 @@ select.graphics.dev <- function(filename, size,
format="png") {
return(dev)
}

+## Create a directory if it does not yet exist
+gen.dir <- function(dir) {
+ if (!file_test("-d", dir)) {
+ if (!dir.create(dir, recursive=TRUE)) {
+ stop("Cannot create directory ", dir)
+ }
+ }
+}
--
2.1.4


Other related posts:

  • » [codeface] [PATCH 1/6] Move gen.dir to a central location - Wolfgang Mauerer