UI.openURL( local_path ) doesn't work on Mac OSX

I’d recommend using Ruby’s methods to properly encoding URIs to make your code more robust. You never know when you suddenly have other characters than spaces.

Reading this thread it sounds like the SU2019.3 bugfix to UI.openURL had some additional side effects.

The reason we changed it was because it was not possible to open URLs with anchors (including #). Other important characters would also be encoded making it impossible to some open valid URLs.
This was happening because the macOS version of SketchUp URI encoded the whole string.

The Windows version of this never URI encoded the string so we decided to make it consistent on both platforms. This means on both platforms you need to provide a proper URI encoded string.

We did expect there might be some extensions breaking because of that, but thought it might be limited since Windows required URL encoding (and it’s the largest user share so most extensions are well tested against that platform.)

However, it appear that many use it to open local files, something we didn’t really test. The API contract for this method as simply been to open the browser with the given URL.

That being said, it sounds like we can improve the documentation for this method to provide references to the Ruby StdLib utilities that can be used to URI encode the strings.

We can also provide examples of how to open local files across both platforms. (Sounds like prefixing file:/// is the cross-platform way to do so. Something maybe IE does automatically and WebKit doesn’t do - but our previous URI encoding did.)

Though, I would have preferred to add a new method that explicitly supported what people are wrangling UI.openURL to do.

1 Like