From e7910da0ad08bfd05343762117e4fa6125ebf532 Mon Sep 17 00:00:00 2001 From: "piedone@pyrocenter.hu" Date: Wed, 14 Dec 2011 23:46:36 +0100 Subject: [PATCH] Tests for IStorageProvider FileExists() and FolderExists() --HG-- branch : 1.x extra : rebase_source : aa49eb8dcb103d8ebd1326197062c81df2b11f44 --- .../Media/FileSystemStorageProvider.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Orchard/FileSystems/Media/FileSystemStorageProvider.cs b/src/Orchard/FileSystems/Media/FileSystemStorageProvider.cs index 980c1fefa..2bba24dce 100644 --- a/src/Orchard/FileSystems/Media/FileSystemStorageProvider.cs +++ b/src/Orchard/FileSystems/Media/FileSystemStorageProvider.cs @@ -64,6 +64,15 @@ namespace Orchard.FileSystems.Media { #region Implementation of IStorageProvider + /// + /// Checks if the given file exists within the storage provider. + /// + /// The relative path within the storage provider. + /// True if the file exists; False otherwise. + public bool FileExists(string path) { + return new FileInfo(MapStorage(path)).Exists; + } + /// /// Retrieves the public URL for a given file within the storage provider. /// @@ -106,6 +115,15 @@ namespace Orchard.FileSystems.Media { .ToList(); } + /// + /// Checks if the given folder exists within the storage provider. + /// + /// The relative path within the storage provider. + /// True if the folder exists; False otherwise. + public bool FolderExists(string path) { + return new DirectoryInfo(MapStorage(path)).Exists; + } + /// /// Lists the folders within a storage provider's path. ///