Extension update admin permission

I install my extension in the c:\ProgramData\SketchUp… location so it is available to all users. I store the user settings in the …users\appdata… folder to avoid permissions issues. For updates however I need to edit the files in the ProgramData location. That works well and the update process is quick and painless, if the user is logged in as admin.

Otherwise the user needs to start SketchUp as admin, or the update fails due to a permissions issue.

  1. Can I somehow request the user to elevate permisions for allowing the update? I thought of downloading an actual installer and then simply launching the installer.
  2. Is there a way to check if the user has access to folder? Perhaps by trying to write a test file?

Any other ideas?

There are a series of such test methods in the core Ruby File class. They were originally written to work with a Unix-like OS, so I don’t know how well they’ve been ported to work under MS Windows. You should likely test.

2 Likes

Make a wild test?
You can have the source files stored inside ProgramData, but also may worth to try using ruby’s File class as Dan mentioned to copy the file to user’s AppData when SketchUp reading those files in ProgramData when launching?
As normally ProgramData is prohibited from writing to it, but copying or generating files in user profile folders are allowed by default.

In an organisation, normally just store the file in a central location, so you can keep using IT management UAC to kind of “push” the latest files to ProgramData.
Then above mentioned method can be a ruby extension within SketchUp, when user launching SketchUp, the latest files are generated in their respective AppData roots - and it can be multiple files and folders too anyway

Personally I’d keep it simple and stick to the same approach SketchUp uses by default when installing an RBZ. By default everything could go in appdata, but if there are many users the IT manager could manually install to ProgramData or even a shared network location.