get_current_script_path: Get the path to the currently running script
Description
This function attempts to determine the file path of the currently executing
R script. It works across multiple contexts:
- In RStudio: returns the path of the active source editor tab.
- In Rscript: extracts the `--file` argument used in script execution.
- When sourced: uses the internal `ofile` value.
Usage
get_current_script_path()
Arguments
Value
A character string with the full path to the current script,
or `NULL` if it cannot be determined.