diff --git a/src/Files.App/Data/Enums/CopyEngineResult.cs b/src/Files.App/Data/Enums/CopyEngineResult.cs index 9f04cc4f9400..42cad448a6a7 100644 --- a/src/Files.App/Data/Enums/CopyEngineResult.cs +++ b/src/Files.App/Data/Enums/CopyEngineResult.cs @@ -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; @@ -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, diff --git a/src/Files.App/Utils/Storage/Operations/ShellFilesystemOperations.cs b/src/Files.App/Utils/Storage/Operations/ShellFilesystemOperations.cs index e80a91e26f69..8c9e60ff49d4 100644 --- a/src/Files.App/Utils/Storage/Operations/ShellFilesystemOperations.cs +++ b/src/Files.App/Utils/Storage/Operations/ShellFilesystemOperations.cs @@ -120,7 +120,7 @@ public async Task CopyItemsAsync(IList 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)) @@ -566,7 +566,7 @@ public async Task MoveItemsAsync(IList 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)) @@ -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)) @@ -799,7 +799,7 @@ public async Task RestoreItemsFromTrashAsync(IList 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))