Skip to content

Commit 2451eb3

Browse files
committed
Added file check to prevent exception
1 parent 8ac4ac4 commit 2451eb3

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/Files.App/Utils/Cloud/Detector/LucidLinkCloudDetector.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@ public sealed class LucidLinkCloudDetector : AbstractCloudDetector
1616
protected override async IAsyncEnumerable<ICloudProvider> GetProviders()
1717
{
1818
string jsonPath = Path.Combine(Constants.UserEnvironmentPaths.HomePath, ".lucid", "app.json");
19-
string volumePath = Path.Combine(Constants.UserEnvironmentPaths.SystemDrivePath, "Volumes");
19+
20+
// Lucid Link v3 and above
21+
if (!File.Exists(jsonPath))
22+
{
23+
string volumePath = Path.Combine(Constants.UserEnvironmentPaths.SystemDrivePath, "Volumes");
24+
await foreach (var provider in GetLucidLinkV3Providers(volumePath))
25+
{
26+
yield return provider;
27+
}
28+
}
2029

2130
var configFile = await StorageFile.GetFileFromPathAsync(jsonPath);
2231
using var jsonFile = JsonDocument.Parse(await FileIO.ReadTextAsync(configFile));
@@ -42,12 +51,6 @@ protected override async IAsyncEnumerable<ICloudProvider> GetProviders()
4251
};
4352
}
4453
}
45-
46-
// Lucid Link v3 and above
47-
await foreach (var provider in GetLucidLinkV3Providers(volumePath))
48-
{
49-
yield return provider;
50-
}
5154
}
5255

5356
private async IAsyncEnumerable<ICloudProvider> GetLucidLinkV3Providers(string volumePath)

0 commit comments

Comments
 (0)