forked from antaldaniel/economy.dataobservatory.eu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_helper.R
30 lines (19 loc) · 793 Bytes
/
config_helper.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
config_helper <- function( config_dir = file.path( "config", "_default") ) {
if ( ! dir.exists ( config_dir) ) {
warning( config_dir, " does not exist.")
return(NULL)
}
potential_config_files <- file.exists (file.path(config_dir, c('config.toml', 'config.yaml')))
if (! any(potential_config_files)) {
warning("No config.toml or config.yaml was found at config_dir='", config_dir, "'")
return(NULL)
}
actual_config_files <- file.path( config_dir, c('config.toml', 'config.yaml') )[potential_config_files]
message ( "Copying ", actual_config_files, " to the root directory of the project.")
file.copy (
from = actual_config_files,
to = c('config.toml', 'config.yaml')[potential_config_files],
overwrite = TRUE
)
}
config_helper ()