Sketchup.find_support_files('rb', 'Plugins') Returns Nothing?

Shouldnt the above command return a list of plugins? I get nothing and am wondering if something is broken? All of my plugins seem to be working with the exception on one (Oob_Layouts) where a list of presets is not populated.

Make sure OSX has not converted your quotes to smart quotes. Notice the difference in quotes from your title to the following:

Sketchup.find_support_files('rb', 'Plugins') 

Search this forum for smart quotes for more topics on the subject and to find out how to get around them ot turn them off.

I was really hoping that was going to workā€¦but alasā€¦same result after I turned off smart quotes!

What happens with:

Sketchup.find_support_file('Plugins')

I donā€™t recall Sketchup.find_support_files ever working on a macā€¦

to see a list of .rb files you need to use other methodsā€¦

path = Sketchup.find_support_file('Plugins') + '/'
rubys = Dir.glob(path + '*.rb')
rubys.each{|r| p r.gsub( path, '' )}; nil

john

Sketchup.find_support_file(ā€˜Pluginsā€™)
ā€¦returnsā€¦
/Users/willkostelecky/Library/Application Support/SketchUp 2017/SketchUp/Plugins

John, that is interesting. My issue is actually with the Oob-Layouts plugin. Hopefully this gives the author a clue. Will

Never use find_support_files. It looks for files in the default plugin locations which may not be where an extension is installed. The user might just as well load it from their dropbox or any other location. Instead use relative paths or absolute paths based on the actual file location you are in. E.g. a path to a file in the same directory as the ruby code itself can be expressed as following.

"#{File.dirname(__FILE__)}/file_name.extension"

Edit: More info here:http://www.thomthom.net/thoughts/2012/09/sketchup-plugins-can-be-installed-anywhere/

1 Like

ā€¦ OR:

having required ā€œppā€ (the loader for the ā€œprettyprintā€ utility,) ie:

require "pp"

then:

Dir::chdir(Sketchup.find_support_file('Plugins')) {
  pp Dir::glob('*.rb')
}

Then to know which files actually were loaded by Ruby:

pp $"

ā€¦ which is the same as:

pp $LOADED_FEATURES

Thanks all. Hopefully this will provide some clues as to some other stuff going wrong as well.

This topic was automatically closed after 91 days. New replies are no longer allowed.