View Single Post
  #1   Spotlight this post!  
Unread 17-08-2012, 01:25
josh.pruim josh.pruim is offline
Registered User
FRC #4014
Team Role: Programmer
 
Join Date: Aug 2012
Rookie Year: 2011
Location: United States
Posts: 36
josh.pruim will become famous soon enough
Determining if code is on cRIO

Hello, I was wondering if there is a good way to determine whether or not the code is running on the cRIO. Since I do not have the cRIO with me, I wrote an if statement that I am guessing would work.

It will return true if it is on the cRIO, false if on a PC/Mac.

Code:
//Lines 2-8 on LimitSwitches/NICompactRIOToolkit.java
public boolean iscRIO(){
		if(System.getProperty("os.arch").contains("amd64") || System.getProperty("os.arch").contains("x86_64") || System.getProperty("os.arch").contains("x86") || System.getProperty("os.arch").contains("i386")){
			return false;
		}else{
			return true;
		}
	}
EDIT: Code is on GitHub, this specific class is here
https://github.com/itguy51/RobotClas...IOToolkit.java


Side note: If anyone knows where to get the WPILibJ libraries as a binary, [.jar or otherwise], that would be very helpful

Last edited by josh.pruim : 17-08-2012 at 01:28. Reason: Added Github Link
Reply With Quote