Skip to content

Commit 13a4442

Browse files
committed
Fix: Path cannot be the empty string or all whitespace
1 parent 48b878e commit 13a4442

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/ExtensionManager.Manifest/Internal/ManifestService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ public async Task<IManifest> ReadAsync(string filePath)
4141

4242
public async Task WriteAsync(string filePath, IManifest manifest, CancellationToken cancellationToken)
4343
{
44-
Directory.CreateDirectory(Path.GetDirectoryName(filePath));
44+
var directoryPath = Path.GetDirectoryName(filePath);
45+
46+
if (string.IsNullOrWhiteSpace(directoryPath))
47+
directoryPath = ".";
48+
49+
Directory.CreateDirectory(directoryPath);
4550

4651
using var stream = File.Create(filePath);
4752

src/ExtensionManager/Features/VisualStudioExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ public static async Task<List<IVSExtension>> GetInstalledExtensionsAsync(this IV
1717
{
1818
var solution = await solutions.GetCurrentOrThrowAsync();
1919

20-
if (solution.Name is null or { Length: 0 })
20+
if (solution.FullPath is null or { Length: 0 })
2121
{
2222
await messageBox.ShowErrorAsync("The solution must be saved in order to manage solution extensions.").ConfigureAwait(false);
2323

2424
return null;
2525
}
2626

27-
return Path.ChangeExtension(solution.Name, ".vsext");
27+
return Path.ChangeExtension(solution.FullPath, ".vsext");
2828
}
2929

3030
public static async Task<IVSSolution> GetCurrentOrThrowAsync(this IVSSolutions solutions)

0 commit comments

Comments
 (0)