Skip to content

Commit

Permalink
normalize project name path
Browse files Browse the repository at this point in the history
  • Loading branch information
nsheff committed Jun 14, 2018
1 parent d9228cf commit c3480ef
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions R/loadConfig.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ loadConfig = function(filename=NULL, sp=NULL) {

cfg$metadata = makeMetadataSectionAbsolute(cfg, parent=dirname(filename))

# Infer default project name

if (is.null(cfg$name)) {
# Default project name is the name of the folder containing the config file
maybeProjectName = basename(dirname(normalizePath(filename)))
if (maybeProjectName == "metadata") {
# Unless it's in a 'metadata' folder, then it's the name of the folder
# one level up
maybeProjectName = basename(dirname(dirname(normalizePath(filename))))
}
cfg$name = maybeProjectName
}

return(cfg)
}

Expand Down

0 comments on commit c3480ef

Please sign in to comment.