Open a Local collection of component definitions in ruby

Reviving this thread because at the time (Aug of 2016) the 2017 release was still in development.

The following November SketchUp 2017 was released and now has a user appdata "Components" directory folder. So since v2017 user component collections are more accessible.

comp_path = File.join(
  File.dirname(Sketchup.find_support_file("Plugins")), "Components"
)
# >> C:/Users/Dan/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Components
File.exist?(comp_path)
# >> true

When your extension loads, you can check for the existence of your plugin’s named sub-folder in the comp_path directory, and if false then copy your component folders over to a plugin specific comp_path subfolder.

plugin_component_lib = File.join(comp_path,my_plugin_dirname)
unless Kernel.test( ?d, plugin_component_lib )
  Dir::mkdir( plugin_component_lib )
  copy_component_folders( plugin_component_lib )
end

You may wish to load FileUtils from the Ruby library to help with the copying tasks …
http://ruby-doc.org/stdlib-2.2.4/libdoc/fileutils/rdoc/index.html

After doing this, the Components browser may need to be refreshed either via UI.refresh_inspectors() or having the user switch folders and back to the root again. (Worse case would be SketchUp needs restarting, but that is usually the best action after installing major extensions anyway.)