Skip to content

Commit c05ea75

Browse files
committed
Remove apache commons dependency and integrate static methods to check OS
1 parent 91082ff commit c05ea75

3 files changed

Lines changed: 62 additions & 16 deletions

File tree

.gitignore

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,54 @@ compiled/
3939
java-package/openbci_gui_helpers/target/
4040

4141
# VS Code
42-
.vscode/
42+
.vscode/
43+
ALL_BUILD.vcxproj
44+
ALL_BUILD.vcxproj.filters
45+
cmake_install.cmake
46+
CMakeCache.txt
47+
GanglionNativeScan.vcxproj
48+
GanglionNativeScan.vcxproj.filters
49+
GanglionScan.vcxproj
50+
GanglionScan.vcxproj.filters
51+
openbci-gui-helpers.sln
52+
ZERO_CHECK.vcxproj
53+
ZERO_CHECK.vcxproj.filters
54+
3rdparty/SimpleBLE/simpleble/simpleble-c.vcxproj
55+
3rdparty/SimpleBLE/simpleble/simpleble-c.vcxproj.filters
56+
3rdparty/SimpleBLE/simpleble/SimpleBLE.sln
57+
3rdparty/SimpleBLE/simpleble/simpleble.vcxproj
58+
3rdparty/SimpleBLE/simpleble/simpleble.vcxproj.filters
59+
3rdparty/SimpleBLE/simpleble/VERSION
60+
3rdparty/SimpleBLE/simpleble/CMakeFiles/generate.stamp
61+
3rdparty/SimpleBLE/simpleble/CMakeFiles/generate.stamp.depend
62+
3rdparty/SimpleBLE/simpleble/export/simpleble/export.h
63+
3rdparty/SimpleBLE/simpleble/libfmt/FMT.sln
64+
3rdparty/SimpleBLE/simpleble/libfmt/fmt.vcxproj
65+
3rdparty/SimpleBLE/simpleble/libfmt/fmt.vcxproj.filters
66+
3rdparty/SimpleBLE/simpleble/libfmt/CMakeFiles/generate.stamp
67+
3rdparty/SimpleBLE/simpleble/libfmt/CMakeFiles/generate.stamp.depend
68+
CMakeFiles/cmake.check_cache
69+
CMakeFiles/CMakeConfigureLog.yaml
70+
CMakeFiles/generate.stamp
71+
CMakeFiles/generate.stamp.depend
72+
CMakeFiles/generate.stamp.list
73+
CMakeFiles/TargetDirectories.txt
74+
CMakeFiles/169bdb6ecb54b9cb29a827f249608a2d/generate.stamp.rule
75+
CMakeFiles/3.27.4/CMakeCXXCompiler.cmake
76+
CMakeFiles/3.27.4/CMakeDetermineCompilerABI_CXX.bin
77+
CMakeFiles/3.27.4/CMakeRCCompiler.cmake
78+
CMakeFiles/3.27.4/CMakeSystem.cmake
79+
CMakeFiles/3.27.4/VCTargetsPath.txt
80+
CMakeFiles/3.27.4/VCTargetsPath.vcxproj
81+
CMakeFiles/3.27.4/CompilerIdCXX/CMakeCXXCompilerId.cpp
82+
CMakeFiles/3.27.4/CompilerIdCXX/CompilerIdCXX.vcxproj
83+
CMakeFiles/3.27.4/CompilerIdCXX/Debug/CompilerIdCXX.exe.recipe
84+
CMakeFiles/3.27.4/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.command.1.tlog
85+
CMakeFiles/3.27.4/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.read.1.tlog
86+
CMakeFiles/3.27.4/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.write.1.tlog
87+
CMakeFiles/3.27.4/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CompilerIdCXX.lastbuildstate
88+
CMakeFiles/3.27.4/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.command.1.tlog
89+
CMakeFiles/3.27.4/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.read.1.tlog
90+
CMakeFiles/3.27.4/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.write.1.tlog
91+
CMakeFiles/3.27.4/x64/Debug/VCTargetsPath.recipe
92+
CMakeFiles/3.27.4/x64/Debug/VCTargetsPath.tlog/VCTargetsPath.lastbuildstate

java-package/openbci_gui_helpers/pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@
2424
<version>5.10.0</version>
2525
</dependency>
2626
<dependency>
27-
<groupId>org.apache.commons</groupId>
28-
<artifactId>commons-lang3</artifactId>
29-
<version>3.1</version>
30-
</dependency>
31-
<dependency>
32-
<groupId>org.apache.commons</groupId>
33-
<artifactId>commons-math3</artifactId>
34-
<version>3.1</version>
35-
</dependency>
36-
<dependency>
3727
<groupId>com.google.code.gson</groupId>
3828
<artifactId>gson</artifactId>
3929
<version>2.6.2</version>

java-package/openbci_gui_helpers/src/main/java/openbci_gui_helpers/GUIHelper.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import java.nio.file.Files;
66
import java.util.ArrayList;
77

8-
import org.apache.commons.lang3.SystemUtils;
9-
108
import com.google.gson.Gson;
119
import com.sun.jna.Library;
1210
import com.sun.jna.Native;
@@ -30,11 +28,11 @@ private interface DllNativeInterface extends Library {
3028

3129
String lib_name = "libGanglionScan.so";
3230
String lib_native_name = "libGanglionNativeScan.so";
33-
if (SystemUtils.IS_OS_WINDOWS) {
31+
if (isWindows()) {
3432
lib_name = "GanglionScan.dll";
3533
lib_native_name = "GanglionNativeScan.dll";
3634

37-
} else if (SystemUtils.IS_OS_MAC) {
35+
} else if (isMac()) {
3836
lib_name = "libGanglionScan.dylib";
3937
lib_native_name = "libGanglionNativeScan.dylib";
4038
}
@@ -55,7 +53,7 @@ private static String unpack_from_jar(String lib_name) {
5553
if (file.exists())
5654
file.delete();
5755
link = (GUIHelper.class.getResourceAsStream(lib_name));
58-
if (SystemUtils.IS_OS_MAC) {
56+
if (isMac()) {
5957
String jarPath = GUIHelper.class.getProtectionDomain().getCodeSource().getLocation().getPath();
6058
File jarFile = new File(jarPath);
6159
String libPathString = jarFile.getParentFile().getAbsolutePath() + File.separator + lib_name;
@@ -120,4 +118,12 @@ public static GanglionDevice[] scan_for_ganglions(int timeout_sec) throws Gangli
120118

121119
return uniqueDevices.toArray(new GanglionDevice[uniqueDevices.size()]);
122120
}
121+
122+
private static boolean isWindows() {
123+
return System.getProperty("os.name").toLowerCase().contains("windows");
124+
}
125+
126+
private static boolean isMac() {
127+
return System.getProperty("os.name").toLowerCase().contains("mac");
128+
}
123129
}

0 commit comments

Comments
 (0)