Files
Umbraco-CMS/src/Umbraco.Core/IO/FileSystemExtensions.cs
T
Shannon Deminick e49bb2dd51 Adds a null check to set the label values, if the content item wasn't loaded then no properties were filled and thsu
no need to update the labels. Cleans up a tiny bit more code.
2013-01-08 00:58:22 +03:00

38 lines
1.3 KiB
C#

using System.IO;
using Umbraco.Core.CodeAnnotations;
namespace Umbraco.Core.IO
{
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
public static class FileSystemExtensions
{
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
internal static long GetSize(this IFileSystem fs, string path)
{
var s = fs.OpenFile(path);
var size = s.Length;
s.Close();
return size;
}
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
internal static void CopyFile(this IFileSystem fs, string path, string newPath)
{
fs.AddFile(newPath, fs.OpenFile(path));
}
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
internal static string GetExtension(this IFileSystem fs, string path)
{
return Path.GetExtension(fs.GetFullPath(path));
}
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
internal static string GetFileName(this IFileSystem fs, string path)
{
return Path.GetFileName(fs.GetFullPath(path));
}
}
}