Hello,

I've been writing a package that allows a script to know its path, and I've
been struggling to get it working for 'R.app' on macOS.

For 'Rgui' on Windows, I used 'utils::getWindowsHandles' to get the
script's path
[image: image.png]
but it's only on Windows, and even if it wasn't, it seems like 'R.app' only
stores the basename in the window handle, so this won't work.

For 'RStudio', they provide a function from the environment 'tools:rstudio'
that retrieves the script's path, and it seems like there's an equivalent
environment 'tools:RGUI' (you can find the source code at this URL:
https://github.com/R-macos/Mac-GUI/blob/5f6557eb9e921319586ac974db22cc1f74ba76ff/GUI-tools.R)
for 'R.app', but it claims to be for internal use only, and doesn't seem to
have a function for retrieving a document's path.

So my question, does anyone know of a way to retrieve the path of the
currently open document in 'R.app'? Thank you!

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to