Get root folder of plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 anni tempo fa
Hi, I'd like to resolve the root folder of a plugin that I'm writing in order to access the logo file and any others I may include.

Currently I'm using:
var path = Server.MapPath("~/Plugins/Misc.MyPlugin/logo.jpg");

It appears to work, but I am concerned this may be an unreliable way to resolve the Plugin's base folder.

I've also searched around and found code that uses PluginDescriptor.OriginalAssemblyFile.Directory from Nop.Core.Plugins but I'm hesitant about including this namespace and wondering if there's an easier way.

Is there a better way to do this?
10 anni tempo fa
m3g4by73 wrote:
Hi, I'd like to resolve the root folder of a plugin that I'm writing in order to access the logo file and any others I may include.

Currently I'm using:
var path = Server.MapPath("~/Plugins/Misc.MyPlugin/logo.jpg");

It appears to work, but I am concerned this may be an unreliable way to resolve the Plugin's base folder.

I've also searched around and found code that uses PluginDescriptor.OriginalAssemblyFile.Directory from Nop.Core.Plugins but I'm hesitant about including this namespace and wondering if there's an easier way.

Is there a better way to do this?


I wouldn't worry too much about the code you are using now. :D
10 anni tempo fa
Ok thanks. I'll leave it as it is.
6 anni tempo fa
m3g4by73 wrote:
Hi, I'd like to resolve the root folder of a plugin that I'm writing in order to access the logo file and any others I may include.

Currently I'm using:
var path = Server.MapPath("~/Plugins/Misc.MyPlugin/logo.jpg");

It appears to work, but I am concerned this may be an unreliable way to resolve the Plugin's base folder.

I've also searched around and found code that uses PluginDescriptor.OriginalAssemblyFile.Directory from Nop.Core.Plugins but I'm hesitant about including this namespace and wondering if there's an easier way.

Is there a better way to do this?


How could you access 'Server' in the plugin class itself?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.