My Building Creator extension uses a windows installer to copy files to the plugins directory rather than using an rbz file. I’ve had complaints that in SketchUp 2019my plugin doesn’t load when SketchUp launches. I haven’t been able to figure out why. I can load it just fine from the ruby console.

EDIT:

To try this create a new test.rb file in the plugins folder. add the following code:

UI.messagebox "test"


I have a trade show coming up in a few days an this is a huge show stopper for me!

Is the installer placing the files in the correct directory? Does manually placing the files there work?

What is the RB file with the Plugins folder doing ?
e.g. Is it setting up an extension using other files in a named subfolder within Plugins.
Are the permissions for the various files and subfolder set up properly, e.g. to let SketchUp read the file ?
Compare the permissions with some other files you know to work.

If you manually add the files into Plugins and restart SketchUp does it work then ?

Has SketchUp been installed properly on the problem PCs ?
Bad permissions and random flakiness are known issues when it’s done incorrectly.
It can be repaired by doing the following…
While logged in as your usual Windows user, ensure SketchUp in closed.
When prompted choose “Repair”.
Restart SketchUp to see if it’s better…

Running an installer exe file in any other way is a recipe for later unpredictable weirdness.
So never double-click it to “Run” it - even if you have admin-powers it is no the same.

You might need to rerun your installer so that the files and folders haven’t inherited the earlier permission issues etc…

Yes. I’ve tried both:
C:\ProgramData\SketchUp\SketchUp 2019\SketchUp\Plugins
and
C:\Users\MyComputer\AppData\Roaming\SketchUp\SketchUp 2019\SketchUp\Plugins

The file registers my extension, and calls a loader.rb. The point is that my rb file is never loaded.
I do have a sub folder properly named. Everything works as advertised if I do this in the ruby console.

load 'path\to\plugin.rb'


Yes

No. Even adding a new test.rb in the plugins folder doesn’t work. See my edit above.

Tried that same issue.

Could it possibly be related to being a trial version of SketchUp?

@thomthom Any input?

Are you getting any error messages? Load errors?

No. As mentioned before the file never tries to load. I can verify this by placing a UI.messagebox on the first line. Doing that in one of the other extension rb files (installed from EW) results in the message being shown before that plugin loads.

How did you create the RB that’s failing to auto-load from the Plugins folder ?
If you open it with Notepad++ what is the file’s encoding reported as ?
It should be UTF-8…

OK it seems there SketchUp must no longer load all files in the plugins folder. Apparently it doesn’t load extensions that were not installed using the extension manager.

I created a zip from my rb file and installed it using the extension manager. No my plugin loads at startup. This is really unhandy to need to add this extra step. Any ideas how I can handle this from my installer? This info must be stored somewhere. Perhaps in the registry. I’ve already checked out the preferences json files.

You are mistaken ?

I just made a new RB file, and an associated subfolder with some code files in.
I then manually added all of it into my user’s AppData 2019 Plugins folder.
I restarted SketchUp and the new RB makes the extension and menu items etc, and runs as expected.
So you do not need to install from a signed RBZ…

I have an idea !

PS: Also check that you only have your files installed in one Plugins location - installing an RBZ uses the current user’s AppData Plugins folder. The one in the ProgramData folder is only used when you want the same extensions to auto-load for all users on that PC…

Did you try that using a trial version of SketchUp 2019?

Yup I already checked all the easy stuff

Yes I understand the way that works.

My installer puts the files in the programdata folder so they are available for everyone. When this issue came up the first thing I tried was copying the files to the user\appdata location.

That’s not correct. Nothing has changed in how we load extensions. And we can verify that extensions load in general. This must be an issue local to the extension/installer/machine.

The one thing we did do was update Ruby to 2.5. If your extension is all Ruby files, no binaries then it should generally keep working. But there are some things that might break as Ruby syntax has become stricter. But you should be getting error messages.

TIG brings up a good point, if you changed the Extension Loading Policy you might see extensions being blocked. If it’s set to “Identified Extension Only” it will silently be blocked. If you set it to “Approve Unidentified Extensions” there should be a message/prompt. “Unrestricted” is the default and doesn’t block anything.

Can you tell us what the output of:

Sketchup.find_support_file('Plugins')

$LOAD_PATH  $LOADED_FEATURES

Sketchup.find_support_file('Plugins')


Plugins

$LOAD_PATH  [“C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib”, “C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/platform_specific”, “C:/Program Files/SketchUp/SketchUp 2019/Tools”, “C:/Users/Server Computer/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Plugins”, “C:/ProgramData/SketchUp/SketchUp 2019/SketchUp/Plugins”] $LOADED_FEATURES


Ok this infuriating. Now since I installed the rbz everything works, even adding a new test.rb file. I’m installing SketchUp 2019 on a different computer so I can get the problem back again.

Ok this is getting really weird.

So before the first run of SketchUp after installing, the plugins folders are not created yet. My installer places the files there creating the plugin folders if necessary. After SketchUp loads, it ignores the files that were already there. If I change the name of my rb file from Building Creator.rb to Building Creator1.rb causes it to load just fine, but as soon as I change it back it won’t load again.

Ok here is something more.

If I delete the extension files from ProgramData and place them in the user directory the plugin loads. Howerver, if the plugin is in both locations or only in the programdata location then it doesn’t load.

Hmmm…

EDIT: But… this is only true for the computer where I installed the RBZ. It’s like the files are somehow blacklisted.

When I try to uninstall the extension I get an error saying ‘Unable to remove extension files.’

This apparently is false.

I removed the Building Creator.rb. Restarted SketchUp and noticed the Building Creator extension was no longer listed. Then I copied the files back in and bingo. My extension loaded.

Uninstall and reinstall SketchUp and I can’t get it to malfunction again on this computer.

OK more mysteries and more answers.

1. It seems my installer was placing files in BOTH the programdata, and the user locations. Removing the files from either location fixed the issue.

2. However the mystery remains because I can add a test.rb in both locations, and only the one in the users folder is loaded (this is correct, expected behavior).

Should return a pathname string like:
C:/Users/Dan/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Plugins

NOT just "Plugins" as you gave above.

VERIFY

Oops typo or pasting error. It gave a path like you show, with a different username of course.

1 Like

Are you being hit by Window’s Virtual Store feature perhaps?