Skip to content

Commit f757249

Browse files
committed
Merge pull request #443 from microsoftgraph/releases/1.1.0
1 parent 9cd81e9 commit f757249

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Authentication/Authentication/Common/DiskDataStore.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ public Stream OpenForSharedRead(string path)
223223
/// <returns>A <see cref="FileStream"/> to the specified path with exclusive write.</returns>
224224
public Stream OpenForExclusiveWrite(string path)
225225
{
226+
string directory = Path.GetDirectoryName(path);
227+
Directory.CreateDirectory(directory);
226228
return File.Open(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
227229
}
228230
}

tools/Custom/PSCmdletExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ internal static string GetProviderPath(this PSCmdlet cmdlet, string filePath, bo
3939

4040
if (provider.Name != "FileSystem" || paths.Count == 0)
4141
{
42-
cmdlet.ThrowTerminatingError(new ErrorRecord(new Exception("Invalid path."), string.Empty, ErrorCategory.InvalidArgument, filePath));
42+
cmdlet.ThrowTerminatingError(new ErrorRecord(new Exception($"Invalid path {filePath}."), string.Empty, ErrorCategory.InvalidArgument, filePath));
4343
}
4444
if (paths.Count > 1)
4545
{
4646
cmdlet.ThrowTerminatingError(new ErrorRecord(new Exception("Multiple paths not allowed."), string.Empty, ErrorCategory.InvalidArgument, filePath));
4747
}
4848
providerPath = paths[0];
4949
}
50-
catch (Exception)
50+
catch (Exception ex)
5151
{
52-
providerPath = filePath;
52+
cmdlet.ThrowTerminatingError(new ErrorRecord(ex, string.Empty, ErrorCategory.InvalidArgument, filePath));
5353
}
5454

5555
return providerPath;

0 commit comments

Comments
 (0)