Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
earnaud committed Dec 9, 2020
1 parent 893134a commit 416b3d8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 15 additions & 7 deletions R/fill-module_saves.R
Original file line number Diff line number Diff line change
Expand Up @@ -401,24 +401,30 @@ saveReactive <- function(main.env, page) {
}

removeDuplicateFiles <- function(filename) {
onlyname <- sub("\\..+", "", basename(filename))
synonyms <- dir(
main.env$save.variable$SelectDP$dp.metadata.path,
pattern = onlyname,
full.names = TRUE
)
file.remove(synonyms[basename(synonyms) != basename(filename)])
if(isContentTruthy(filename)){
onlyname <- sub("\\..+", "", basename(filename))
synonyms <- dir(
main.env$save.variable$SelectDP$dp.metadata.path,
pattern = onlyname,
full.names = TRUE
)
file.remove(synonyms[basename(synonyms) != basename(filename)])
}
}

# save
.sv$Misc <- content

# Fill template for abstract
saveHTMLasMD(content$abstract)
if(!is.character(content$abstract$file))
content$abstract$file <- paste0(.sv$SelectDP$dp.metadata.path, "/abstract.txt")
removeDuplicateFiles(content$abstract$file)

# Fill template for methods
saveHTMLasMD(content$methods)
if(!is.character(content$methods$file))
content$methods$file <- paste0(.sv$SelectDP$dp.metadata.path, "/abstract.txt")
removeDuplicateFiles(content$methods$file)

# Fill template for keywords
Expand All @@ -442,6 +448,8 @@ saveReactive <- function(main.env, page) {
)
# Fill template for additional information
saveHTMLasMD(content$additional.information)
if(!is.character(content$additional.information$file))
content$additional.information$file <- paste0(.sv$SelectDP$dp.metadata.path, "/abstract.txt")
removeDuplicateFiles(content$additional.information$file)

# Remove non-md files
Expand Down
2 changes: 1 addition & 1 deletion R/template_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ templateModules <- function(main.env, page){
stop("EAL template issues - GeoCov")
})

if(class(x) == "try-error")
if(class(x) == "try-error" && main.env$dev)
browser()

if(class(x) == "try-error") {
Expand Down

0 comments on commit 416b3d8

Please sign in to comment.