Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/1.1.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Apr 24, 2019
2 parents 6869474 + c26d7e0 commit 52d36eb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.cryptomator</groupId>
<artifactId>dokany-nio-adapter</artifactId>
<version>1.1.6</version>
<version>1.1.7</version>
<description>Access resources at a given NIO path via Dokany.</description>
<name>Dokany-NIO Adapter</name>
<url>https://github.com/cryptomator/dokany-nio-adapter</url>
Expand Down Expand Up @@ -121,7 +121,7 @@
<dependency>
<groupId>org.cryptomator</groupId>
<artifactId>cryptofs</artifactId>
<version>1.7.0</version>
<version>1.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private static String addEscapeSequencesForPathPattern(String rawPattern) {

public static Set<OpenOption> buildOpenOptions(EnumIntegerSet<AccessMask> accessMasks, EnumIntegerSet<FileAccessMask> fileAccessMasks, EnumIntegerSet<FileAttribute> fileAttributes, EnumIntegerSet<CreateOptions> createOptions, CreationDisposition creationDisposition, boolean append, boolean fileExists) {
Set<OpenOption> openOptions = Sets.newHashSet();
if (accessMasks.contains(AccessMask.GENERIC_WRITE) || fileAccessMasks.contains(FileAccessMask.READ_DATA)) {
if (accessMasks.contains(AccessMask.GENERIC_WRITE) || fileAccessMasks.contains(FileAccessMask.WRITE_DATA) || fileAccessMasks.contains(FileAccessMask.APPEND_DATA)) {
openOptions.add(StandardOpenOption.WRITE);
}
if (accessMasks.contains(AccessMask.GENERIC_READ) || fileAccessMasks.contains(FileAccessMask.READ_DATA)) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/cryptomator/frontend/dokany/OpenFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ public synchronized int write(Pointer buf, int num, long offset) throws IOExcept
return written;
}

public int append(Pointer buf, int num) throws IOException {
return write(buf, num, channel.size());
}

private int readNext(ByteBuffer readBuf, long num) throws IOException {
readBuf.clear();
readBuf.limit((int) Math.min(readBuf.capacity(), num));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,11 @@ public int writeFile(WString rawPath, Pointer rawBuffer, int rawNumberOfBytesToW

try (PathLock pathLock = lockManager.createPathLock(path.toString()).forReading();
DataLock dataLock = pathLock.lockDataForWriting()) {
rawNumberOfBytesWritten.setValue(handle.write(rawBuffer, rawNumberOfBytesToWrite, rawOffset));
if (dokanyFileInfo.writeToEndOfFile()) {
rawNumberOfBytesWritten.setValue(handle.append(rawBuffer, rawNumberOfBytesToWrite));
} else {
rawNumberOfBytesWritten.setValue(handle.write(rawBuffer, rawNumberOfBytesToWrite, rawOffset));
}
LOG.trace("({}) Data successful written to {}.", dokanyFileInfo.Context, path);
return Win32ErrorCode.ERROR_SUCCESS.getMask();
} catch (IOException e) {
Expand Down

0 comments on commit 52d36eb

Please sign in to comment.