I've created a file ~/test.R which Emacs expands to C:/Users/iris/AppData/Roaming/test.R. When I load that file, R runs .ess.source("~/test.R") which R expands to C:/Users/iris/Documents/test.R and then throws an error about the file not existing. Perhaps .ess.source() could expand the path before passing to source(), something like:
if (.Platform$OS.type == "windows") {
## ideally we'd use startsWith(),
## but that was introduced in R 3.3.0,
## so we'll have to use grepl() instead
# if (startsWith(file, "~/") || startsWith(file, "~\\")) {
## this matches the behaviour of R_ExpandFileName for Windows
if (grepl("(?i)^~(?![a-z])", file, perl = TRUE, useBytes = TRUE)) {
file <- paste0(Sys.getenv("APPDATA"), substring(file, 2L))
}
}
Hi!
I've created a file
~/test.R
which Emacs expands toC:/Users/iris/AppData/Roaming/test.R
. When I load that file, R runs.ess.source("~/test.R")
which R expands toC:/Users/iris/Documents/test.R
and then throws an error about the file not existing. Perhaps.ess.source()
could expand the path before passing tosource()
, something like:Thank you!