cryptomator / dokany-nio-adapter

Dokany-based adapter to provide directory contents specified by a java.nio.file.Path (via dokan-java)
GNU Affero General Public License v3.0
14 stars 4 forks source link

deleteFile(): Try to accquire FileLock throws exception #25

Closed infeo closed 5 years ago

infeo commented 5 years ago

Commit: d0ab54bdf7f929d4a376f5d984af8719abf858c4 OS: Windows 10 Pro 1809 Dokan: 1.2.2.1000

In the deleteFile() method, the adapter tries to determine if a file can be deleted via accquiring a file lock on the opened file channel. If the channel is read-only this throw an uncatched NonWriteableChannelException.

Some applications create temporary files, save there the current app content and transfer this content to the actual file by opening a read-only file channel to the tmp file. After successful transfer the tmp file (possibly still opened with as read-only) is deleted.

infeo commented 5 years ago

Since we cannot say anything about the delete status of File in java other than getting a file lock, we return deleteStatus true if the channel is read-only.

infeo commented 5 years ago

closed with b9ff922f6cee164e1cd430dae10a56d3b0a45a5e