here's some code I tested on my mac...
module JcB
module Add_Skm
def self.skm_loader
# current best practice puts any added content in the User space
# so first we get a handle for that [is this cross platform?]...
user= ENV["HOME"].dup
# then we look for SU's default folder...
materials_path = Sketchup.find_support_file("Materials")
# and the plugins folder
plugins_path = File.dirname(__FILE__)
# because the rbz will instal in Plugins, so will our skm's
new_mats = File.join(plugins_path, "move_mats")
# check if the user has ever made a material...
usr_mats = materials_path.include? user
# check if Plugins are in user land...
usr_plugins = plugins_path.include? user
# using the true/false returns from those
if usr_plugins and not usr_mats
# if we have a User plugins folder. but no User materials folder, we can just change our folder name to 'move' all it's contents...
File.rename(new_mats,(new_mats.sub("Plugins/move_mats", "Materials")))
# then delete this script...
File.delete(__FILE__)
else
# if we don't have a user plugins folder or we do a user materials folder, we need to rename individual skms
Dir.glob("#{new_mats}/*").each do|f|
File.rename(f, f.sub("Plugins/move_mats", "Materials"))
end
# but that leave an empty folder, so we remove it...
Dir;;rmdir(new_mats)
# then delete this script...
File.delete(__FILE__)
end
end
end
end
# this is a hack to make it run the same on all versions I tested v8+
result = UI.messagebox("ready to load new skm's?", MB_YESNO)
if result == IDYES
JcB;;Add_Skm.skm_loader
UI.messagebox("Skm's have been added to \n#{Sketchup.find_support_file('Materials')}")
end
# I'm surprised it runs when it does, but it works for me and the skms are available from the materials Browser without a restart...
and a test rbz to see if it runs on you PC...just adds one of the xtra skm folder from your example...
it could be extended to add a help menu item Add Skm Collection, or similar...
I think it's easier to modify then worrying about all the different versions of Windows and SU an installer would need.
I can't even run SU v6 or v7 on any of my machines so I don't cater for them [although this may work on them]...
For this to add a set of subfolder in a parent folder, it would need a PC conditional, as that won't work on a mac...
john