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

Unable to save already exisiting files #15

Closed infeo closed 5 years ago

infeo commented 5 years ago

Windows Version: Windows 10 Pro 1809 Dokany Version: ecb2d5a838b0b44b06bb463042caa9deac2150f0

Using the current version of the dokany-nio-adapter, saving already existing files is not possible anymore with specific programs (e.g. altered pdfs with adobe acrobat reader).

It seems the regression happend in commit 2896a5c80d681ec3953a5cb70ac0e3ec018f0400. The change was that with this commit a filechannel is not opened always with the Write option but it depends on the parameters of the zwCreateFile() function.

infeo commented 5 years ago

I found the cause of this bug: Opening a filechannel with the flag CREATE_NEW (or CREATE and the targeted file does not exists) and without the WRITE flag throws a NoSuchFileException. So we have to make sure, that every time we create a new file the respective file channel is also writeable.