Help: Paths & Co
-
I have a problem: I would like a plugin with icons.
The plugin and the icons are on a network drive, not on the lokal plugins-Folder
I invite the external plugins with the following script$GLOBAL_PLUGIN_DIR = "L;/SketchUp/Plugins/" def require2_alll(dirname) begin rbfiles = Dir[File.join(dirname, "*.rb")] rbsfiles = Dir[File.join(dirname, "*.rbs")] $;.push dirname rbfiles.each {|f| require f} rbsfiles.each {|f| require f} rescue puts "could not load files from #{dirname}" end end require2_alll $GLOBAL_PLUGIN_DIR
The plugins are loaded, but I do not load the icons
Is there another solution to plugins completely put on a network drive?
I think within the scripts, the paths will not.I'm sorry for the bad English, but I hope someone understands it.
-
Only the Ruby method "Require" and "Load" use the globals $: and $".
For other methods loading files such as icons or images, the path is taken from the method arguments, without reference to the absolute path of Ruby in $:.
In addition, several plugins assume that they are located in the Sketchup Plugin folder to compute path to files to be loaded. This is the case for my plugins in current versions (I am changing the strategy for my next versions however).The question of alternate directory for Pluginsis anyway very interesting, because:
- this allows to sahre plugins between different version of Sketchup (useful when we have SU6 and SU7, with pro and Free versions)
- on Windows Vista, you have to configure some security rules in order to copy and write to files loacted in the C:/Program Files(x86).
- in network configurations or in some offices, the access to the drive may simply be prohibited
So using an alternate folder on a private drive gives a lot more flexibility. Technically, it is just a matter of respecting some programming rules. But, for users that are not able to write scripts, there must be some conventions for providing an esay configuration tool for Sketchup to tell where scripts are.
This deserves reflection and I am sure that the community of Ruby scripters could come with a solution.
Fredo
Advertisement