@@ -796,7 +796,7 @@ public async Task<bool> RenameFileItem(ListedItem item, string oldName, string n
796
796
renamed = await AssociatedInstance . FilesystemViewModel . GetFileFromPathAsync ( item . ItemPath )
797
797
. OnSuccess ( t => t . RenameAsync ( newName , NameCollisionOption . FailIfExists ) . AsTask ( ) ) ;
798
798
}
799
- if ( renamed . ErrorCode == FilesystemErrorCode . ERROR_UNAUTHORIZED )
799
+ if ( renamed == FilesystemErrorCode . ERROR_UNAUTHORIZED )
800
800
{
801
801
// Try again with MoveFileFromApp
802
802
if ( ! NativeDirectoryChangesHelper . MoveFileFromApp ( item . ItemPath , Path . Combine ( Path . GetDirectoryName ( item . ItemPath ) , newName ) ) )
@@ -805,24 +805,24 @@ public async Task<bool> RenameFileItem(ListedItem item, string oldName, string n
805
805
return false ;
806
806
}
807
807
}
808
- else if ( renamed . ErrorCode == FilesystemErrorCode . ERROR_NOTAFILE || renamed . ErrorCode == FilesystemErrorCode . ERROR_NOTAFOLDER )
808
+ else if ( renamed == FilesystemErrorCode . ERROR_NOTAFILE || renamed == FilesystemErrorCode . ERROR_NOTAFOLDER )
809
809
{
810
810
await DialogDisplayHelper . ShowDialog ( "RenameError.NameInvalid.Title" . GetLocalized ( ) , "RenameError.NameInvalid.Text" . GetLocalized ( ) ) ;
811
811
}
812
- else if ( renamed . ErrorCode == FilesystemErrorCode . ERROR_NAMETOOLONG )
812
+ else if ( renamed == FilesystemErrorCode . ERROR_NAMETOOLONG )
813
813
{
814
814
await DialogDisplayHelper . ShowDialog ( "RenameError.TooLong.Title" . GetLocalized ( ) , "RenameError.TooLong.Text" . GetLocalized ( ) ) ;
815
815
}
816
- else if ( renamed . ErrorCode == FilesystemErrorCode . ERROR_INUSE )
816
+ else if ( renamed == FilesystemErrorCode . ERROR_INUSE )
817
817
{
818
818
// TODO: proper dialog, retry
819
819
await DialogDisplayHelper . ShowDialog ( "FileInUseDeleteDialog/Title" . GetLocalized ( ) , "" ) ;
820
820
}
821
- else if ( renamed . ErrorCode == FilesystemErrorCode . ERROR_NOTFOUND )
821
+ else if ( renamed == FilesystemErrorCode . ERROR_NOTFOUND )
822
822
{
823
823
await DialogDisplayHelper . ShowDialog ( "RenameError.ItemDeleted.Title" . GetLocalized ( ) , "RenameError.ItemDeleted.Text" . GetLocalized ( ) ) ;
824
824
}
825
- else if ( ! renamed )
825
+ else if ( renamed == FilesystemErrorCode . ERROR_ALREADYEXIST )
826
826
{
827
827
var ItemAlreadyExistsDialog = new ContentDialog ( )
828
828
{
@@ -913,7 +913,7 @@ await AssociatedInstance.FilesystemViewModel.GetFileFromPathAsync(iFilePath)
913
913
{
914
914
await DialogDisplayHelper . ShowDialog ( "FileNotFoundDialog/Title" . GetLocalized ( ) , "FileNotFoundDialog/Text" . GetLocalized ( ) ) ;
915
915
}
916
- else
916
+ else if ( restored . HasFlag ( FilesystemErrorCode . ERROR_ALREADYEXIST ) )
917
917
{
918
918
await DialogDisplayHelper . ShowDialog ( "ItemAlreadyExistsDialogTitle" . GetLocalized ( ) , "ItemAlreadyExistsDialogContent" . GetLocalized ( ) ) ;
919
919
}
0 commit comments