Build full path to base folder where batches of files will be stored.
Source:R/cas_get_base_path.R
cas_get_base_path.RdFor more information on how the full path is determined, see details.
Usage
cas_get_base_path(
create_folder_if_missing = NULL,
custom_path = NULL,
custom_folder = NULL,
index = FALSE,
file_format = "html",
...
)Arguments
- create_folder_if_missing
Logical, defaults to NULL. If NULL, it will ask before creating a new folder. If TRUE, it will create it without asking.
- custom_path
Defaults to NULL. If given, overrides all other inputs, and is returned as given.
- custom_folder
Defaults to NULL. Folder name within the website folder is typically determined by
file_formatand eitherindexorcontents; if you prefer another option, different from bothindexandcontents, you can set it using thecustom_folderargument.- file_format
Defaults to
html. Used to determine folder name, and internally to assume contents type when using functions such ascas_extract().- ...
Passed to
cas_get_options().
Details
base_folder- path to the folder where all project files are expected to be stored. Can be retrieved withcas_get_base_folder(level = "base"), can be set for the whole session withcas_set_options(base_folder = fs::path(fs::path_temp(), "castarter").project- project name, typically set withcas_set_options(project = "example_project)website- website name, typically set withcas_set_options(website = "example_project)a combination of
file_formatand eitherindex,contents, or something different if set with thecustom_folderargument.
Examples
set.seed(1)
cas_set_options(project = "example_project",
website = "example_website",
base_folder = fs::path(fs::path_temp(), "castarter"))
cas_get_base_path(create_folder_if_missing = FALSE)
#> ℹ Folder for contents files with file format html does not exist:
#> ℹ /tmp/RtmprKtXJ9/castarter/example_project/example_website/html_contents
#> Warning: ! Base path returned, but the folder does not exist and has not been created.
#> /tmp/RtmprKtXJ9/castarter/example_project/example_website/html_contents
cas_get_base_path(file_format = "html",
create_folder_if_missing = FALSE)
#> ℹ Folder for contents files with file format html does not exist:
#> ℹ /tmp/RtmprKtXJ9/castarter/example_project/example_website/html_contents
#> Warning: ! Base path returned, but the folder does not exist and has not been created.
#> /tmp/RtmprKtXJ9/castarter/example_project/example_website/html_contents
cas_get_base_path(file_format = "xml",
create_folder_if_missing = FALSE)
#> ℹ Folder for contents files with file format xml does not exist:
#> ℹ /tmp/RtmprKtXJ9/castarter/example_project/example_website/xml_contents
#> Warning: ! Base path returned, but the folder does not exist and has not been created.
#> /tmp/RtmprKtXJ9/castarter/example_project/example_website/xml_contents
cas_get_base_path(index = TRUE,
create_folder_if_missing = FALSE)
#> ℹ Folder for index files with file format html does not exist:
#> ℹ /tmp/RtmprKtXJ9/castarter/example_project/example_website/html_index
#> Warning: ! Base path returned, but the folder does not exist and has not been created.
#> /tmp/RtmprKtXJ9/castarter/example_project/example_website/html_index