Skip to content

Commit

Permalink
FileSystemStorage - base folder
Browse files Browse the repository at this point in the history
  • Loading branch information
KSemenenko committed Apr 7, 2022
1 parent 2313741 commit 29f6842
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Product>Managed Code - Storage</Product>
<Version>1.1.0</Version>
<PackageVersion>1.1.0</PackageVersion>
<Version>1.1.1</Version>
<PackageVersion>1.1.1</PackageVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
Expand Down
2 changes: 1 addition & 1 deletion ManagedCode.Storage.FileSystem/FileSystemStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class FileSystemStorage : IFileSystemStorage

public FileSystemStorage(FileSystemStorageOptions fileSystemStorageOptions)
{
_path = Path.Combine(fileSystemStorageOptions.CommonPath, fileSystemStorageOptions.Path);
_path = fileSystemStorageOptions?.BaseFolder ?? Environment.CurrentDirectory;
EnsureDirectoryExists();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace ManagedCode.Storage.FileSystem.Options;

public class FileSystemStorageOptions
{
public string CommonPath { get; set; } = null!;
public string Path { get; set; } = null!;
{
public string BaseFolder { get; set; } = null!;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public static ServiceProvider ConfigureServices()

services.AddFileSystemStorageAsDefault(opt =>
{
opt.CommonPath = Path.Combine(Environment.CurrentDirectory, "managed-code-bucket");
opt.Path = "managed-code-bucket";
opt.BaseFolder = Path.Combine(Environment.CurrentDirectory, "managed-code-bucket");
});

return services.BuildServiceProvider();
Expand Down
6 changes: 2 additions & 4 deletions ManagedCode.Storage.Tests/FileSystem/FileSystemTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ protected override ServiceProvider ConfigureServices()

services.AddFileSystemStorageAsDefault(opt =>
{
opt.CommonPath = Path.Combine(Environment.CurrentDirectory, "managed-code-bucket");
opt.Path = "managed-code-bucket";
opt.BaseFolder = Path.Combine(Environment.CurrentDirectory, "managed-code-bucket");
});

services.AddFileSystemStorage(new FileSystemStorageOptions
{
CommonPath = Path.Combine(Environment.CurrentDirectory, "managed-code-bucket"),
Path = "managed-code-bucket"
BaseFolder = Path.Combine(Environment.CurrentDirectory, "managed-code-bucket")
});
return services.BuildServiceProvider();
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![img|300x200](https://github.com/managed-code-hub/Storage/raw/main/logo.png)
![img|300x200](https://raw.githubusercontent.com/managed-code-hub/Storage/main/logo.png)
# ManagedCode.Storage
[![.NET](https://github.com/managed-code-hub/Storage/actions/workflows/dotnet.yml/badge.svg)](https://github.com/managed-code-hub/Storage/actions/workflows/dotnet.yml)
[![Coverage Status](https://coveralls.io/repos/github/managed-code-hub/Storage/badge.svg?branch=main&service=github)](https://coveralls.io/github/managed-code-hub/Storage?branch=main)
Expand Down
6 changes: 2 additions & 4 deletions Samples/WebApiSample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@

builder.Services.AddFileSystemStorageAsDefault(new FileSystemStorageOptions
{
CommonPath = Path.Combine(Environment.CurrentDirectory, "managed-code-bucket"),
Path = "managed-code-bucket"
BaseFolder = Path.Combine(Environment.CurrentDirectory, "managed-code-bucket"),
});

builder.Services.AddFileSystemStorage(new FileSystemStorageOptions
{
CommonPath = Path.Combine(Environment.CurrentDirectory, "managed-code-bucket"),
Path = "managed-code-bucket"
BaseFolder = Path.Combine(Environment.CurrentDirectory, "managed-code-bucket"),
});

#endregion
Expand Down

0 comments on commit 29f6842

Please sign in to comment.