Skip to content

Feature: Hide pCloud from drives list #14084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions src/Files.App/Data/Models/AppModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,15 @@ public string GoogleDrivePath
get => googleDrivePath;
set => SetProperty(ref googleDrivePath, value);
}

private string pCloudDrivePath = string.Empty;
/// <summary>
/// Gets or sets a value indicating the path for pCloud Drive.
/// </summary>
public string PCloudDrivePath
{
get => pCloudDrivePath;
set => SetProperty(ref pCloudDrivePath, value);
}
}
}
3 changes: 2 additions & 1 deletion src/Files.App/Services/RemovableDrivesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public async IAsyncEnumerable<ILocatableFolder> GetDrivesAsync()
{
var list = DriveInfo.GetDrives();
var googleDrivePath = App.AppModel.GoogleDrivePath;
var pCloudDrivePath = App.AppModel.PCloudDrivePath;

foreach (var drive in list)
{
Expand All @@ -43,7 +44,7 @@ public async IAsyncEnumerable<ILocatableFolder> GetDrivesAsync()
var driveItem = await DriveItem.CreateFromPropertiesAsync(res.Result, drive.Name.TrimEnd('\\'), label, type, thumbnail);

// Don't add here because Google Drive is already displayed under cloud drives
if (drive.Name == googleDrivePath)
if (drive.Name == googleDrivePath || drive.Name == pCloudDrivePath)
continue;

App.Logger.LogInformation($"Drive added: {driveItem.Path}, {driveItem.Type}");
Expand Down
2 changes: 2 additions & 0 deletions src/Files.App/Utils/Cloud/CloudDrivesDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ private static Task<IEnumerable<ICloudProvider>> DetectpCloudDrive()
string iconPath = Path.Combine(programFilesFolder, "pCloud Drive", "pCloud.exe");
var iconFile = Win32API.ExtractSelectedIconsFromDLL(iconPath, new List<int>() { 32512 }, 32).FirstOrDefault();

App.AppModel.PCloudDrivePath = syncedFolder;

results.Add(new CloudProvider(CloudProviders.pCloud)
{
Name = $"pCloud Drive",
Expand Down