I’m developing a plugin which is working fine (though not yet perfectly) in SU2016.
On trying to test it in older versions of SU (back to v8) I realise that using
require_relative won’t work, but am finding it hard to figure out what to replace it with. Have searched this forum, and hunted through all the plugins I have installed, to see how it was done earlier, but not (quite) found what I want. I understand that the current directory is no longer included in the Ruby search path, and that
require_relative works around that in later versions of SU, but isn’t a valid command in earlier ones (before Ruby 2, hence before SU2014 if I’ve understood correctly).
I think I need something like:
if Sketchup.version.to_f < 14.0 require_relative('other') else # Resource paths FILENAMESPACE = File.basename( __FILE__, '.rb' ) PATH_ROOT = File.dirname( __FILE__ ) PATH = File.join( PATH_ROOT, FILENAMESPACE ) PATH_OTHER = File.join( PATH, 'other' ) require('other') end #if
Is this right? If not, what should I use for the plugin to work in earlier versions of SU?
I may find there are other things that don’t work, in which case I may have to abandon the effort, but at the moment, loading is aborting with the (understandable) Ruby console message
undefined method require_relative .
And a supplementary related question: when I restart SU after attempting ‘Install Extension’ from the Preferences/Extensions menu, where are my plugin files being installed for SU8 on Mac? Or aren’t they installed, even though I earlier got the message that the installation was successful?
I can’t see them in either
~/Library/Application Support/Google Sketchup 8/Sketchup/ (where there is no Plugins folder at all). Is that because there are no other plugins installed?
/Applications/Google Sketchup 8/Sketchup.app/Contents/Plugins
It just makes debugging harder, because I can’t directly edit the files, and instead have to edit the originals, make them again into an RBZ file, then re-try the installation in SU8.