Created
January 10, 2012 20:19
-
-
Save chadmyers/1590956 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Reflection; | |
using FubuCore.Reflection; | |
namespace FubuCore.Binding | |
{ | |
public class MapWebToPhysicalPathFamily : StatelessConverter | |
{ | |
public override bool Matches(PropertyInfo property) | |
{ | |
return property.HasAttribute<MapWebToPhysicalPathAttribute>(); | |
} | |
public override object Convert(IPropertyContext context) | |
{ | |
var strVal = context.PropertyValue as String; | |
return strVal.IsNotEmpty() | |
? strVal.ToPhysicalPath() | |
: strVal; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string ToPhysicalPath(this string webRelativePath) | |
{ | |
if (!_isAbsolute(webRelativePath)) | |
{ | |
webRelativePath = _combine("~", webRelativePath); | |
} | |
return _mapPath(webRelativePath); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment