Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

browseURL not opening folders and files with default apps #5486

Open
avila opened this issue Nov 25, 2024 · 2 comments
Open

browseURL not opening folders and files with default apps #5486

avila opened this issue Nov 25, 2024 · 2 comments
Labels
area: console Issues related to Console category. bug Something isn't working lang: r support
Milestone

Comments

@avila
Copy link

avila commented Nov 25, 2024

System details:

Positron and OS details:

Positron Version: 2024.12.0 build 41
Code - OSS Version: 1.93.0
Commit: 39536c265d6828a68291984d0d359170316d055e
Date: 2024-11-18T02:42:16.243Z
Electron: 30.4.0
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Linux x64 6.11.9-amd64

Interpreter details:

  • R 4.4.2

Describe the issue:

browseURL() does not work as expected in the built-in console (likely using Ark). However, it works as intended when called from R in the built-in terminal (e.g., browseURL(".")). I use browseURL() to open exported files with the default external program, even though the function is intended for opening URLs in a browser. While related issues/PRs exist (e.g., #4468, #4151, #4297), this specific issue is undocumented as far as I could tell.

Steps to reproduce the issue:

temp_file <- tempfile()
write.csv(iris, temp_file)
browseURL(temp_file)  # nothing happens

browseURL(tempdir()) # nothing happens

Expected or desired behavior:

The file or folder should be opened with respective default application.

Were there any error messages in the UI, Output panel, or Developer Tools console?

No.

@avila
Copy link
Author

avila commented Nov 25, 2024

After quick checks, I see that the argument browser in the signature of browseURL is getOption("browser") by default. And the default option differ if called from the console (Ark?) or from R within the Terminal.

from console

> getOption("browser")
function(url) {
    .ps.Call("ps_browse_url", as.character(url))
}
<environment: 0x55b8659722f8>

from R (built-in Terminal or any terminal)

> getOption("browser")
[1] "xdg-open"

from RStudio (works as expected!!)

> getOption("browser")
function (url) 
{
    .Call("rs_browseURL", url, PACKAGE = "(embedding)")
}
<environment: 0x557c2bacfea8>

So, a workaround is setting the browser option to xdg-open for now.

options(browser="xdg-open")
browseURL(tempdir()) # works

@avila avila changed the title browseURL not opening folders browseURL not opening folders and files with default apps Nov 25, 2024
@jonvanausdeln
Copy link
Contributor

@avila , thank you for the report! I can also reproduce the issue. I'll move it forward to our triage process!

@jonvanausdeln jonvanausdeln added area: console Issues related to Console category. lang: r support bug Something isn't working labels Nov 25, 2024
@juliasilge juliasilge added this to the Future milestone Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: console Issues related to Console category. bug Something isn't working lang: r support
Projects
None yet
Development

No branches or pull requests

3 participants