Plugin distribution best practices

Hello!
Had a few questions regarding the distribution of a plugin. This plugin depends on a console app that is to be installed along with the plugin. The plugin will also need a dedicated space to write/read from for some operations.

What I have seen before is that plugin devs will install program specific stuff into Program Files or Application folders, and user specific stuff (configuration files, temp read / write) to AppData or Documents folders.

I’ve never created an installer before, but I am wondering if there is enough in the rhi framework to help me achieve this, or if I should be looking to create an installer so that everything lands in the right place?

At the moment the plugin is a proof of concept, most Rhino parts working well. My main conundrums deal when considering the potentially limitless configurations, security restrictions, etc users out there might face. While I can imagine I will not get it right the first time, it would be nice to start out with some hints on how to minimize the type of user cases.

This could also serve as a general discussion, not just with my specific plugin concerns. Is the RHI framework meant to be a facilitator for plugin distribution?

Thx!

Yes it is. I would start with it. If you run into roadblocks let us know.

http://wiki.mcneel.com/developer/rhinoinstallerengine/overview

Great Dale!
That gets me most of the way there. I was able to zip it all up and the rhi installed. My extra stuff was installed as well. Plugin loads, runs fine. Now I need to update how I had some settings in order to reflect the new install locations.
Are there easy properties that I can use to access the ‘Common’ directory and assembly directory location? I see some things in Rhino.PlugIns.PlugIn, and System.Reflection.Assembly, but this is new ground for me and I would need to access the folders where things were installed for settings, configs, etc. Since the Rhino installer could potentially install it in a few different places (User vs all Users, etc) how do I ensure that I can always get to the …\MyPlugin{GUID}\VersionNumber\MyPlugin\Rhino Version\Common or x84 or x86?
Thx.

If you want to get the directory in which your plug-in (assembly) is located, then you can use this method:

string assemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
string assemblyPath = System.IO.Path.GetDirectoryName(assemblyLocation);
RhinoApp.WriteLine(assemblyPath);

If your plug-in assembly is in an “x86” or “x64” folder, and you have stuff in a “Common” folder which is at the same level, you can build a path string as follows:

System.IO.DirectoryInfo directoryInfo = System.IO.Directory.GetParent(assemblyPath);
string commonPath = directoryInfo.FullName + @"\Common";
RhinoApp.WriteLine(commonPath);
1 Like

Clear, thank you!

Hello,

While speaking about best practices, it is better to concatenate path strings with the System.IO.Path.Combine method.
Appart from preventing developer mistakes, it also moves the responsibility of the path concatenation to the framework which may adapt its functionning depending on the target platform (eg: OS/X).

Thus, the following code:

string commonPath = directoryInfo.FullName + @"\Common";

should have been written:

string commonPath = System.IO.Path.Combine(directoryInfo.FullName, "Common");

See the following pages for more details: