Skip to content

Commit

Permalink
Feature: Hide pCloud from drives list (#14084)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 authored Nov 26, 2023
1 parent f0badb2 commit ae07ddf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
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

0 comments on commit ae07ddf

Please sign in to comment.