Skip to content

Commit cf5a152

Browse files
committed
And actually use the new Version class.
1 parent 5666d3d commit cf5a152

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/main/java/io/ipfs/api/IPFS.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
public class IPFS {
1313

14-
public static final String MIN_VERSION = "0.4.10";
14+
public static final Version MIN_VERSION = Version.parse("0.4.10");
1515
public enum PinType {all, direct, indirect, recursive}
1616
public List<String> ObjectTemplates = Arrays.asList("unixfs-dir");
1717
public List<String> ObjectPatchTypes = Arrays.asList("add-link", "rm-link", "set-data", "append-data");
@@ -53,12 +53,8 @@ public IPFS(String host, int port, String version) {
5353
this.version = version;
5454
// Check IPFS is sufficiently recent
5555
try {
56-
String ipfsVersion = version();
57-
String[] parts = ipfsVersion.split("\\.");
58-
String[] minParts = MIN_VERSION.split("\\.");
59-
if (parts[0].compareTo(minParts[0]) < 0
60-
|| parts[1].compareTo(minParts[1]) < 0
61-
|| parts[2].compareTo(minParts[2]) < 0)
56+
Version detected = Version.parse(version());
57+
if (detected.isBefore(MIN_VERSION))
6258
throw new IllegalStateException("You need to use a more recent version of IPFS! >= " + MIN_VERSION);
6359
} catch (IOException e) {
6460
throw new RuntimeException(e);

0 commit comments

Comments
 (0)