Skip to content
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
2 changes: 2 additions & 0 deletions src/Files.App/Data/Enums/CopyEngineResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public struct CopyEngineResult
// File in use
public const int COPYENGINE_E_SHARING_VIOLATION_SRC = -2144927705;
public const int COPYENGINE_E_SHARING_VIOLATION_DEST = -2144927704;
public const int HRESULT_ERROR_SHARING_VIOLATION = -2147024864;
// Already exists
public const int COPYENGINE_E_ALREADY_EXISTS_NORMAL = -2144927703;
public const int COPYENGINE_E_ALREADY_EXISTS_READONLY = -2144927702;
Expand Down Expand Up @@ -83,6 +84,7 @@ public static FileSystemStatusCode Convert(int? hres)
CopyEngineResult.COPYENGINE_E_FLD_IS_FILE_DEST => FileSystemStatusCode.NotAFolder,
CopyEngineResult.COPYENGINE_E_SHARING_VIOLATION_SRC => FileSystemStatusCode.InUse,
CopyEngineResult.COPYENGINE_E_SHARING_VIOLATION_DEST => FileSystemStatusCode.InUse,
CopyEngineResult.HRESULT_ERROR_SHARING_VIOLATION => FileSystemStatusCode.InUse,
CopyEngineResult.COPYENGINE_E_STREAM_LOSS => FileSystemStatusCode.PropertyLoss,
CopyEngineResult.COPYENGINE_E_EA_LOSS => FileSystemStatusCode.PropertyLoss,
CopyEngineResult.COPYENGINE_E_PROPERTY_LOSS => FileSystemStatusCode.PropertyLoss,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public async Task<IStorageHistory> CopyItemsAsync(IList<IStorageItemWithPath> so
else if (copyResult.Items.Any(x => CopyEngineResult.Convert(x.HResult) == FileSystemStatusCode.InUse))
{
var failedSources = copyResult.Items.Where(x => CopyEngineResult.Convert(x.HResult) == FileSystemStatusCode.InUse);
var filePath = failedSources.Select(x => x.HResult == CopyEngineResult.COPYENGINE_E_SHARING_VIOLATION_SRC ? x.Source : x.Destination);
var filePath = failedSources.Select(x => x.HResult == CopyEngineResult.COPYENGINE_E_SHARING_VIOLATION_DEST ? x.Destination : x.Source);
var lockingProcess = WhoIsLocking(filePath);

switch (await GetFileInUseDialog(filePath, lockingProcess))
Expand Down Expand Up @@ -566,7 +566,7 @@ public async Task<IStorageHistory> MoveItemsAsync(IList<IStorageItemWithPath> so
else if (moveResult.Items.Any(x => CopyEngineResult.Convert(x.HResult) == FileSystemStatusCode.InUse))
{
var failedSources = moveResult.Items.Where(x => CopyEngineResult.Convert(x.HResult) == FileSystemStatusCode.InUse);
var filePath = failedSources.Select(x => x.HResult == CopyEngineResult.COPYENGINE_E_SHARING_VIOLATION_SRC ? x.Source : x.Destination);
var filePath = failedSources.Select(x => x.HResult == CopyEngineResult.COPYENGINE_E_SHARING_VIOLATION_DEST ? x.Destination : x.Source);
var lockingProcess = WhoIsLocking(filePath);

switch (await GetFileInUseDialog(filePath, lockingProcess))
Expand Down Expand Up @@ -694,7 +694,7 @@ await DynamicDialogFactory
else if (renameResult.Items.Any(x => CopyEngineResult.Convert(x.HResult) == FileSystemStatusCode.InUse))
{
var failedSources = renameResult.Items.Where(x => CopyEngineResult.Convert(x.HResult) == FileSystemStatusCode.InUse);
var filePath = failedSources.Select(x => x.HResult == CopyEngineResult.COPYENGINE_E_SHARING_VIOLATION_SRC ? x.Source : x.Destination);
var filePath = failedSources.Select(x => x.HResult == CopyEngineResult.COPYENGINE_E_SHARING_VIOLATION_DEST ? x.Destination : x.Source);
var lockingProcess = WhoIsLocking(filePath);

switch (await GetFileInUseDialog(filePath, lockingProcess))
Expand Down Expand Up @@ -799,7 +799,7 @@ public async Task<IStorageHistory> RestoreItemsFromTrashAsync(IList<IStorageItem
else if (moveResult.Items.Any(x => CopyEngineResult.Convert(x.HResult) == FileSystemStatusCode.InUse))
{
var failedSources = moveResult.Items.Where(x => CopyEngineResult.Convert(x.HResult) == FileSystemStatusCode.InUse);
var filePath = failedSources.Select(x => x.HResult == CopyEngineResult.COPYENGINE_E_SHARING_VIOLATION_SRC ? x.Source : x.Destination);
var filePath = failedSources.Select(x => x.HResult == CopyEngineResult.COPYENGINE_E_SHARING_VIOLATION_DEST ? x.Destination : x.Source);
var lockingProcess = WhoIsLocking(filePath);

switch (await GetFileInUseDialog(filePath, lockingProcess))
Expand Down
Loading