Skip to content

Commit

Permalink
add file system name capability to Winfsp mounter
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Jan 20, 2023
1 parent d5a0044 commit cdd1cbc
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.Set;
import java.util.concurrent.TimeoutException;

import static org.cryptomator.integrations.mount.MountCapability.FILE_SYSTEM_NAME;
import static org.cryptomator.integrations.mount.MountCapability.MOUNT_AS_DRIVE_LETTER;
import static org.cryptomator.integrations.mount.MountCapability.MOUNT_FLAGS;
import static org.cryptomator.integrations.mount.MountCapability.MOUNT_TO_EXISTING_DIR;
Expand All @@ -47,7 +48,7 @@ public boolean isSupported() {

@Override
public Set<MountCapability> capabilities() {
return EnumSet.of(MOUNT_FLAGS, MOUNT_AS_DRIVE_LETTER, MOUNT_WITHIN_EXISTING_PARENT, UNMOUNT_FORCED, READ_ONLY, VOLUME_NAME);
return EnumSet.of(MOUNT_FLAGS, MOUNT_AS_DRIVE_LETTER, MOUNT_WITHIN_EXISTING_PARENT, UNMOUNT_FORCED, READ_ONLY, VOLUME_NAME, FILE_SYSTEM_NAME);
}

@Override
Expand All @@ -63,6 +64,8 @@ public MountBuilder forFileSystem(Path vfsRoot) {

protected static class WinFspMountBuilder extends AbstractMountBuilder {

private static String DEFAULT_FS_NAME = "FUSE-NIO-FS";
String fsName = DEFAULT_FS_NAME;
boolean isReadOnly = false;

WinFspMountBuilder(Path vfsRoot) {
Expand All @@ -80,6 +83,12 @@ public MountBuilder setMountpoint(Path mountPoint) {
}
}

@Override
public MountBuilder setFileSystemName(String fsName) {
this.fsName = fsName;
return this;
}

@Override
public MountBuilder setReadOnly(boolean mountReadOnly) {
isReadOnly = mountReadOnly;
Expand All @@ -98,6 +107,8 @@ protected Set<String> combinedMountFlags() {
combined.removeIf(flag -> flag.startsWith("-oumask="));
combined.add("-oumask=0333");
}
combined.removeIf(flag -> flag.startsWith("-oExactFileSystemName="));
combined.add("-oExactFileSystemName="+fsName);
return combined;
}

Expand Down

0 comments on commit cdd1cbc

Please sign in to comment.