Skip to content

Commit

Permalink
VLC Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
PulseBeat02 committed Nov 12, 2021
1 parent 9712c27 commit 92cd7f0
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.io.IOException;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Optional;

public final class VLCInstallationKit {

Expand All @@ -49,21 +50,23 @@ public final class VLCInstallationKit {
* not be found, it will download the respective binary for the user operating system and load
* that libvlc that way.
*
* @return Optional containing path if found, otherwise empty
*
* @throws IOException if an issue occurred during installation
*/
public void start() throws IOException {
this.installBinary(true, this.others);
public Optional<Path> start() throws IOException {
return this.installBinary(true, this.others);
}

private void installBinary(final boolean chmod, final Path... others) throws IOException {
this.searchAndLoadBinary(VLCInstaller.create().download(chmod), others);
private Optional<Path> installBinary(final boolean chmod, final Path... others) throws IOException {
return this.searchAndLoadBinary(VLCInstaller.create().download(chmod), others);
}

private void searchAndLoadBinary(final Path binary, final Path... others) {
private Optional<Path> searchAndLoadBinary(final Path binary, final Path... others) {
final VLCDiscovery discovery = VLCDiscovery.create();
discovery.addSearchPath(binary);
Arrays.stream(others).forEach(discovery::addSearchPath);
discovery.discover();
return discovery.discover();
}

/**
Expand Down

0 comments on commit 92cd7f0

Please sign in to comment.