mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-02 11:44:41 +08:00
Tests for IStorageProvider FileExists() and FolderExists()
--HG-- branch : 1.x extra : rebase_source : aa49eb8dcb103d8ebd1326197062c81df2b11f44
This commit is contained in:
@@ -64,6 +64,15 @@ namespace Orchard.FileSystems.Media {
|
||||
|
||||
#region Implementation of IStorageProvider
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the given file exists within the storage provider.
|
||||
/// </summary>
|
||||
/// <param name="path">The relative path within the storage provider.</param>
|
||||
/// <returns>True if the file exists; False otherwise.</returns>
|
||||
public bool FileExists(string path) {
|
||||
return new FileInfo(MapStorage(path)).Exists;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the public URL for a given file within the storage provider.
|
||||
/// </summary>
|
||||
@@ -106,6 +115,15 @@ namespace Orchard.FileSystems.Media {
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the given folder exists within the storage provider.
|
||||
/// </summary>
|
||||
/// <param name="path">The relative path within the storage provider.</param>
|
||||
/// <returns>True if the folder exists; False otherwise.</returns>
|
||||
public bool FolderExists(string path) {
|
||||
return new DirectoryInfo(MapStorage(path)).Exists;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lists the folders within a storage provider's path.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user