1

Inside a given Orchard module, how to determine the path to the physical directory where that module is installed?

In alternative, how to programatically determine the Module's name?

Piotr Szmyd
  • 13,371
  • 6
  • 44
  • 61
pvieira
  • 1,687
  • 6
  • 17
  • 32

1 Answers1

3

You can retrieve the module name twofold:

  • Orchard module acts as an ASP.NET MVC 3 area, so answer to your second question is here and here. This is the better way.
  • Or use reflection and get the name from the currently executing assembly, which is named like your module:

    Assembly.GetExecutingAssembly().GetName().Name

If you have the name, getting the physical directory is as easy as writing:

HostingEnvironment.MapPath(@"~/Modules/" + moduleName)
Community
  • 1
  • 1
Piotr Szmyd
  • 13,371
  • 6
  • 44
  • 61