tags:

views:

23

answers:

1

I have a T4Template:

<#@ template language="C#" debug="True" hostspecific="True" #>

<#@ output extension=".cs" #> <#@ assembly name="System.Web" #> <#@ assembly name="System.Web.Mvc" #> <#@ import namespace="System.Web.Mvc" #> <#@ import namespace="System.IO" #> <#@ import namespace="System.Web" #> using System; namespace MyNamespace.SomePages {<#string folderPath = @"D:_Source\TOG\aaaaaa\bbbbbbb\ccccccc\"; string[] folders = Directory.GetDirectories(folderPath); foreach(string folderName in folders){if(!folderName.Contains(".svn")){#>

public static class <#= System.IO.Path.GetFileName(folderName)#>
{

<#foreach(string file in Directory.GetFiles(folderName)){#> public const string <#= System.IO.Path.GetFileNameWithoutExtension(file) #> = "<#= System.IO.Path.GetFileNameWithoutExtension(file).ToString()#>"; <#}#> } <#}}#>}

how can i get a relative path for "folderPath" as that path is different on all the developers machines

A: 

HostingEnvironment.VirtualPathProvider.GetDirectory("~/MyPagesPathj");

Dusty Roberts