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


#1

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.


#2

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.


#3

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


#4

What happens with:

Sketchup.find_support_file('Plugins')


#5

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


#6

Sketchup.find_support_file(‘Plugins’)
…returns…
/Users/willkostelecky/Library/Application Support/SketchUp 2017/SketchUp/Plugins


#7

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


#8

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/


#9

… 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

#10

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


#11

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