Creates and initializes a directory structure for caching ExploreCourses XML data.
This function ensures a consistent location for storing cached course and department
data between sessions. If no cache directory is specified, it creates a default
directory named 'explorecourses_cache'
in the current working directory.
Details
The function performs the following operations:
If
cache_dir
isNULL
, constructs default path usingDEFAULT_CACHE_DIR
Creates the directory if it doesn't exist (including parent directories)
Ensures the directory is writable
Returns the full path to the created/existing directory
The function uses fs::dir_create()
which is safe for concurrent access
and handles nested directory creation automatically.
Error handling
If directory creation fails due to permissions or other filesystem errors. The error will include the attempted path and specific error message.
See also
write_xml_cache()
for writing data to the cacheread_xml_cache()
for reading data from the cacheclear_cache()
for removing cached data