Skip to content

Commit

Permalink
Merge pull request #81 from nicomem/feature/no-hardcoded-lib-paths
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter authored Sep 28, 2023
2 parents c32f9b4 + b9b85c5 commit 3f6d8a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<!-- dependencies -->
<integrations-api.version>1.3.0</integrations-api.version>
<jfuse.version>0.6.0</jfuse.version>
<jfuse.version>0.6.2</jfuse.version>
<slf4j.version>2.0.7</slf4j.version>
<caffeine.version>3.1.7</caffeine.version>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class LinuxFuseMountProvider implements MountService {
private static final Logger LOG = LoggerFactory.getLogger(LinuxFuseMountProvider.class);
private static final Path USER_HOME = Paths.get(System.getProperty("user.home"));
private static final String[] LIB_PATHS = {
"/usr/lib/libfuse3.so", // default
"/lib/x86_64-linux-gnu/libfuse3.so.3", // debian amd64
"/lib/aarch64-linux-gnu/libfuse3.so.3", // debian aarch64
"/usr/lib64/libfuse3.so.3", // fedora
Expand All @@ -55,7 +54,7 @@ public String displayName() {

@Override
public boolean isSupported() {
return Arrays.stream(LIB_PATHS).map(Path::of).anyMatch(Files::exists) && isFusermount3Installed();
return isFusermount3Installed();
}

private boolean isFusermount3Installed() {
Expand Down Expand Up @@ -115,9 +114,8 @@ public Mount mount() throws MountFailedException {
Objects.requireNonNull(mountPoint);
Objects.requireNonNull(mountFlags);

var libPath = Arrays.stream(LIB_PATHS).map(Path::of).filter(Files::exists).map(Path::toString).findAny().orElseThrow();
var builder = Fuse.builder();
builder.setLibraryPath(libPath);
Arrays.stream(LIB_PATHS).map(Path::of).filter(Files::exists).map(Path::toString).findAny().ifPresent(builder::setLibraryPath);
if (mountFlags.contains("-oallow_other") || mountFlags.contains("-oallow_root")) {
LOG.warn("Mounting with flag -oallow_other or -oallow_root. Ensure that in /etc/fuse.conf option user_allow_other is enabled.");
}
Expand Down

0 comments on commit 3f6d8a3

Please sign in to comment.