Commit a24904e8 authored by Holger Brandl's avatar Holger Brandl

added workaround for escape characters when interpolating strings

parent ab2c8cdf
......@@ -586,9 +586,10 @@ add_prefix = function(filename) {
## https://stackoverflow.com/questions/18669886/how-to-unfold-user-and-environment-variable-in-r-language/46240642#46240642
interp_from_env = function(path){
# DEBUG path="${genomeFasta}.algncounts.txt"
e <- new.env()
env = Sys.getenv() %>% discard(~ str_detect(.x, fixed("()")))
paste0(make.names(names(env)), "='", gsub("'", '', env), "'") %>%
paste0(make.names(names(env)), "='", gsub("'", '', env) %>% str_replace_all(fixed("\\"), ""), "'") %>%
map(~eval(parse(text=.), envir=e))
# (system("export", intern=T) %>% str_split_fixed(" ", 2))[,2] %>% map(~eval(parse(text=.), envir=e))
glue::glue(path, .envir=e, .open="${")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment