Skip to content

Commit 5aca34d

Browse files
authored
Added support for Box and iCloud (#2325)
1 parent 7d1be78 commit 5aca34d

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

Files/Filesystem/CloudProvider.cs

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ public enum KnownCloudProviders
2020
OneDriveBusiness,
2121
Mega,
2222
GoogleDrive,
23-
DropBox
23+
DropBox,
24+
iCloud,
25+
Box
2426
}
2527

2628
public class CloudProvider
@@ -36,9 +38,59 @@ public static async Task<List<CloudProvider>> GetInstalledCloudProviders()
3638
await DetectGoogleDriveAsync(providerList);
3739
await DetectDropboxAsync(providerList);
3840
await DetectMegaAsync(providerList);
41+
await DetectBoxAsync(providerList);
42+
await DetectiCloudAsync(providerList);
3943
return providerList;
4044
}
4145

46+
#region Box
47+
private static async Task DetectBoxAsync(List<CloudProvider> providerList)
48+
{
49+
try
50+
{
51+
var infoPath = @"Box\Box\data\shell\sync_root_folder.txt";
52+
var configPath = Path.Combine(UserDataPaths.GetDefault().LocalAppData, infoPath);
53+
var configFile = await StorageFile.GetFileFromPathAsync(configPath);
54+
var syncPath = await FileIO.ReadTextAsync(configFile);
55+
if (!string.IsNullOrEmpty(syncPath))
56+
{
57+
providerList.Add(new CloudProvider()
58+
{
59+
ID = KnownCloudProviders.Box,
60+
SyncFolder = syncPath,
61+
Name = "Box"
62+
});
63+
}
64+
}
65+
catch
66+
{
67+
// Not detected
68+
}
69+
}
70+
#endregion
71+
72+
#region iCloud
73+
private static async Task DetectiCloudAsync(List<CloudProvider> providerList)
74+
{
75+
try
76+
{
77+
var userPath = UserDataPaths.GetDefault().Profile;
78+
var iCloudPath = "iCloudDrive";
79+
var driveFolder = await StorageFolder.GetFolderFromPathAsync(Path.Combine(userPath, iCloudPath));
80+
providerList.Add(new CloudProvider()
81+
{
82+
ID = KnownCloudProviders.iCloud,
83+
SyncFolder = driveFolder.Path,
84+
Name = "iCloud"
85+
});
86+
}
87+
catch
88+
{
89+
// Not detected
90+
}
91+
}
92+
#endregion
93+
4294
#region DropBox
4395
private static async Task DetectDropboxAsync(List<CloudProvider> providerList)
4496
{

0 commit comments

Comments
 (0)