Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search for lib in java.library.path instead of hardcoded path #81

Merged
merged 4 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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