Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/Files.App/Utils/Cloud/Detector/GoogleDriveCloudDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ await FilesystemTasks.Wrap(() => StorageFile.GetFileFromPathAsync(Path.Combine(a
path = path.Substring(@"\\?\".Length);
}

var folder = await StorageFolder.GetFolderFromPathAsync(path);
var folderResult = await FilesystemTasks.Wrap(() => StorageFolder.GetFolderFromPathAsync(path).AsTask());
if (!folderResult)
{
_logger.LogWarning($"Could not access Google Drive path as local storage: {path}");
continue;
}

var folder = folderResult.Result;
string title = reader["title"]?.ToString() ?? folder.Name;

Debug.WriteLine("YIELD RETURNING from `GoogleDriveCloudDetector.GetProviders()` (roots): ");
Expand All @@ -89,7 +96,14 @@ await FilesystemTasks.Wrap(() => StorageFile.GetFileFromPathAsync(Path.Combine(a
if (!AddMyDriveToPathAndValidate(ref path))
continue;

var folder = await StorageFolder.GetFolderFromPathAsync(path);
var folderResult = await FilesystemTasks.Wrap(() => StorageFolder.GetFolderFromPathAsync(path).AsTask());
if (!folderResult)
{
_logger.LogWarning($"Could not access Google Drive path as local storage: {path}");
continue;
}

var folder = folderResult.Result;
string title = reader["name"]?.ToString() ?? folder.Name;

Debug.WriteLine("YIELD RETURNING from `GoogleDriveCloudDetector.GetProviders` (media): ");
Expand Down Expand Up @@ -269,7 +283,8 @@ private static bool ValidatePath(string path)

var iconPath = Path.Combine(programFilesEnvVar, "Google", "Drive File Stream", "drive_fs.ico");

return await FilesystemTasks.Wrap(() => StorageFile.GetFileFromPathAsync(iconPath).AsTask());
var iconFileResult = await FilesystemTasks.Wrap(() => StorageFile.GetFileFromPathAsync(iconPath).AsTask());
return iconFileResult ? iconFileResult.Result : null;
}

private static bool AddMyDriveToPathAndValidate(ref string path)
Expand Down
Loading