Adds some more error checking to PhysicalFileSystem ctor. Fixing issues with Script/Style repo tests.

This commit is contained in:
Shannon Deminick
2013-01-15 01:15:08 +03:00
parent dfb6953792
commit d0cccb5be6
5 changed files with 13 additions and 6 deletions

View File

@@ -18,7 +18,11 @@ namespace Umbraco.Core.IO
public PhysicalFileSystem(string virtualRoot)
{
RootPath = IOHelper.MapPath(virtualRoot);
if (virtualRoot == null) throw new ArgumentNullException("virtualRoot");
if (!virtualRoot.StartsWith("~/"))
throw new ArgumentException("The virtualRoot argument must be a virtual path and start with '~/'");
RootPath = IOHelper.MapPath(virtualRoot);
_rootUrl = IOHelper.ResolveUrl(virtualRoot);
}
@@ -30,6 +34,9 @@ namespace Umbraco.Core.IO
if (string.IsNullOrEmpty(rootUrl))
throw new ArgumentException("The argument 'rootUrl' cannot be null or empty.");
if (rootPath.StartsWith("~/"))
throw new ArgumentException("The rootPath argument cannot be a virtual path and cannot start with '~/'");
RootPath = rootPath;
_rootUrl = rootUrl;
}