Patch tmpdir
Showing 1 of 7 files from the diff.
R/utilities.R
changed.
Other files ignored by Codecov
man/set_java_tmp_dir.Rd
is new.
DESCRIPTION
has changed.
tests/testthat/test-utils.R
has changed.
NAMESPACE
has changed.
man/xlsx-package.Rd
has changed.
man/addDataFrame.Rd
has changed.
@@ -41,6 +41,8 @@
Loading
41 | 41 | rJava::.jpackage("xlsxjars") |
|
42 | 42 | rJava::.jpackage(pkgname, lib.loc = libname) # needed to load RInterface.java |
|
43 | 43 | ||
44 | + | set_java_tmp_dir(getOption("xlsx.tempdir", tempdir())) |
|
45 | + | ||
44 | 46 | # what's your java version? Need > 1.5.0. |
|
45 | 47 | jversion <- .jcall('java.lang.System','S','getProperty','java.version') |
|
46 | 48 |
@@ -129,6 +131,42 @@
Loading
129 | 131 | } |
|
130 | 132 | ||
131 | 133 | ||
134 | + | #' Set Java Temp Directory |
|
135 | + | #' |
|
136 | + | #' Java sets the java temp directory to `/tmp` by default. However, this is |
|
137 | + | #' usually not desirable in R. As a result, this function allows changing that |
|
138 | + | #' behavior. Further, this function is fired on package load to ensure all |
|
139 | + | #' temp files are written to the R temp directory. |
|
140 | + | #' |
|
141 | + | #' On package load, we use `getOption("xlsx.tempdir", tempdir())` for the |
|
142 | + | #' default value, in case you want to have this value set by an option. |
|
143 | + | #' |
|
144 | + | #' @param tmp_dir optional. The new temp directory. Defaults to the R temp |
|
145 | + | #' directory |
|
146 | + | #' |
|
147 | + | #' @return The previous java temp directory (prior to any changes). |
|
148 | + | #' |
|
149 | + | #' @export |
|
150 | + | set_java_tmp_dir <- function(tmp_dir = tempdir()) { |
|
151 | + | rJava::.jcall( |
|
152 | + | "java/lang/System", |
|
153 | + | "Ljava/lang/String;", |
|
154 | + | "setProperty", |
|
155 | + | "java.io.tmpdir", tmp_dir |
|
156 | + | ) |
|
157 | + | } |
|
158 | + | ||
159 | + | #' @rdname set_java_tmp_dir |
|
160 | + | #' @export |
|
161 | + | get_java_tmp_dir <- function() { |
|
162 | + | rJava::.jcall( |
|
163 | + | "java/lang/System", |
|
164 | + | "Ljava/lang/String;", |
|
165 | + | "getProperty", |
|
166 | + | "java.io.tmpdir" |
|
167 | + | ) |
|
168 | + | } |
|
169 | + | ||
132 | 170 | #' @title Constants used in the project. |
|
133 | 171 | #' |
|
134 | 172 | #' @description Document some Apache POI constants used in the project. |
Files | Coverage |
---|---|
R | 84.84% |
Project Totals (25 files) | 84.84% |
54.3
54.4
54.4
54.3
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.