diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 390e581..368f781 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,8 @@ name: build env: - v: '2.0.1' + # v: '2.0.2' + v: '2.0.2-pre.1' av: '2.0.0' on: diff --git a/docs/release-history.md b/docs/release-history.md index 22f73d3..6517100 100644 --- a/docs/release-history.md +++ b/docs/release-history.md @@ -1,4 +1,9 @@ -## 2.0.1 +## 2.0.2 + +### New +- Connection string for disk (`disk://`) can be passed without path, in which case the instance is created against entire disk. + +## 2.0.1 Local disk file storage provider now implements `ILocalDiskFileStorage` interface, which exposes `ToNativeLocalPath` method returning full path to the file on the local disk, specific to the OS you are running on. This is useful when you need to pass file paths to external tools or libraries that need native OS paths. diff --git a/src/Stowage.Test/Integration/Impl/LocalDiskTest.cs b/src/Stowage.Test/Integration/Impl/LocalDiskTest.cs index fb014fd..dd1b171 100644 --- a/src/Stowage.Test/Integration/Impl/LocalDiskTest.cs +++ b/src/Stowage.Test/Integration/Impl/LocalDiskTest.cs @@ -23,5 +23,11 @@ public async Task ResolveToNativePath() { Assert.True(nativePath.Length > 0); } + + [Fact] + public async Task CreateFromConnectionString() { + IFileStorage ifs = Files.Of.ConnectionString("disk://"); + Assert.NotNull(ifs); + } } } diff --git a/src/Stowage/Factories/BuiltInConnectionFactory.cs b/src/Stowage/Factories/BuiltInConnectionFactory.cs index be27ba5..a93b47b 100644 --- a/src/Stowage/Factories/BuiltInConnectionFactory.cs +++ b/src/Stowage/Factories/BuiltInConnectionFactory.cs @@ -9,9 +9,9 @@ namespace Stowage.Factories { class BuiltInConnectionFactory : IConnectionFactory { public IFileStorage? Create(ConnectionString connectionString) { if(connectionString.Prefix == "disk") { - connectionString.GetRequired("path", true, out string path); + string? path = connectionString.Get("path"); - return new LocalDiskFileStorage(path); + return path == null ? Files.Of.EntireLocalDisk(): Files.Of.LocalDisk(path); } if(connectionString.Prefix == "inmemory") {