Skip to content

Commit

Permalink
💀
Browse files Browse the repository at this point in the history
Signed-off-by: Jade Turner <[email protected]>
  • Loading branch information
spacey-sooty committed Nov 10, 2024
1 parent 68f1a29 commit a735e05
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.photonvision.common.hardware;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand Down Expand Up @@ -114,6 +115,11 @@ public static boolean isSupported() {
return currentPlatform.isSupported;
}

public static boolean isAthena() {
File runRobotFile = new File("/usr/local/frc/bin/frcRunRobot.sh");
return runRobotFile.exists();
}

//////////////////////////////////////////////////////

// Debug info related to unknown platforms for debug help
Expand All @@ -122,7 +128,21 @@ public static boolean isSupported() {
private static final String UnknownPlatformString =
String.format("Unknown Platform. OS: %s, Architecture: %s", OS_NAME, OS_ARCH);

public static Platform getCurrentPlatform() {
public static synchronized Platform getCurrentPlatform() {
String OS_NAME;
if (Platform.OS_NAME != null) {
OS_NAME = Platform.OS_NAME;
} else {
OS_NAME = System.getProperty("os.name");
}

String OS_ARCH;
if (Platform.OS_ARCH != null) {
OS_ARCH = Platform.OS_ARCH;
} else {
OS_ARCH = System.getProperty("os.arch");
}

if (OS_NAME.startsWith("Windows")) {
if (OS_ARCH.equals("x86") || OS_ARCH.equals("i386")) {
return WINDOWS_32;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.photonvision.jni;

import edu.wpi.first.util.RuntimeDetector;
import edu.wpi.first.util.RuntimeLoader;
import java.io.File;
import java.io.FileOutputStream;
Expand All @@ -42,7 +41,7 @@ public static boolean load_() throws IOException, UnsatisfiedLinkError {
var clazz = PhotonTargetingJniLoader.class;

for (var libraryName : List.of("photontargeting", "photontargetingJNI")) {
if (RuntimeDetector.isAthena()) {
if (Platform.isAthena()) {
System.out.println("Detected rio - loading directly");
RuntimeLoader.loadLibrary(libraryName);
continue;
Expand Down

0 comments on commit a735e05

Please sign in to comment.