Skip to content

Commit

Permalink
remove usage of delete file in mob and winsdk
Browse files Browse the repository at this point in the history
  • Loading branch information
Hitenjain14 committed Jun 11, 2024
1 parent 3726075 commit 7eba1aa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
9 changes: 8 additions & 1 deletion mobilesdk/zbox/allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,14 @@ func (a *Allocation) DeleteFile(remotePath string) error {
if a == nil || a.sdkAllocation == nil {
return ErrInvalidAllocation
}
return a.sdkAllocation.DeleteFile(remotePath)
a.sdkAllocation.SetCheckStatus(true)
defer a.sdkAllocation.SetCheckStatus(false)
return a.sdkAllocation.DoMultiOperation([]sdk.OperationRequest{
{
OperationType: constants.FileOperationDelete,
RemotePath: remotePath,
},
})
}

// RenameObject - rename or move file
Expand Down
9 changes: 8 additions & 1 deletion mobilesdk/zbox/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,14 @@ func DeleteFile(allocationID, remotePath string) error {
if err != nil {
return err
}
return a.DeleteFile(remotePath)
a.SetCheckStatus(true)
defer a.SetCheckStatus(false)
return a.DoMultiOperation([]sdk.OperationRequest{
{
OperationType: constants.FileOperationDelete,
RemotePath: remotePath,
},
})
}

// RenameObject - rename or move file
Expand Down
7 changes: 6 additions & 1 deletion winsdk/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ func Delete(allocationID, path *C.char) *C.char {

s := C.GoString(path)

err = alloc.DeleteFile(s)
err = alloc.DoMultiOperation([]sdk.OperationRequest{
{
OperationType: "delete",
RemotePath: s,
},
})

if err != nil {
return WithJSON(false, err)
Expand Down

0 comments on commit 7eba1aa

Please sign in to comment.