Merge with 4.11.2

This commit is contained in:
Sebastiaan Janssen
2012-12-28 09:02:45 -01:00
8 changed files with 108 additions and 205 deletions

View File

@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using Umbraco.Core.CodeAnnotations;
using Umbraco.Core.Logging;
@@ -10,7 +10,6 @@ using Umbraco.Core.Publishing;
namespace Umbraco.Core.IO
{
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
internal class PhysicalFileSystem : IFileSystem
{
@@ -45,9 +44,13 @@ namespace Umbraco.Core.IO
return Directory.EnumerateDirectories(path).Select(GetRelativePath);
}
catch (UnauthorizedAccessException ex)
{ }
{
LogHelper.Error<PhysicalFileSystem>("Not authorized to get directories", ex);
}
catch (DirectoryNotFoundException ex)
{ }
{
LogHelper.Error<PhysicalFileSystem>("Directory not found", ex);
}
return Enumerable.Empty<string>();
}
@@ -67,7 +70,9 @@ namespace Umbraco.Core.IO
Directory.Delete(GetFullPath(path), recursive);
}
catch (DirectoryNotFoundException ex)
{ }
{
LogHelper.Error<PhysicalFileSystem>("Directory not found", ex);
}
}
public bool DirectoryExists(string path)
@@ -82,9 +87,7 @@ namespace Umbraco.Core.IO
public void AddFile(string path, Stream stream, bool overrideIfExists)
{
if (FileExists(path) && !overrideIfExists)
throw new InvalidOperationException(string.Format("A file at path '{0}' already exists",
path));
if (FileExists(path) && !overrideIfExists) throw new InvalidOperationException(string.Format("A file at path '{0}' already exists", path));
EnsureDirectory(Path.GetDirectoryName(path));
@@ -110,9 +113,13 @@ namespace Umbraco.Core.IO
return Directory.EnumerateFiles(path, filter).Select(GetRelativePath);
}
catch (UnauthorizedAccessException ex)
{ }
{
LogHelper.Error<PhysicalFileSystem>("Not authorized to get directories", ex);
}
catch (DirectoryNotFoundException ex)
{ }
{
LogHelper.Error<PhysicalFileSystem>("Directory not found", ex);
}
return Enumerable.Empty<string>();
}
@@ -193,7 +200,7 @@ namespace Umbraco.Core.IO
protected string EnsureTrailingSeparator(string path)
{
if (!path.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
if (!path.EndsWith(Path.DirectorySeparatorChar.ToString(CultureInfo.InvariantCulture), StringComparison.Ordinal))
path = path + Path.DirectorySeparatorChar;
return path;