mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Allows passing in the main robot class from the command line (#1091)
This commit is contained in:
committed by
Peter Johnson
parent
86c1f8ae50
commit
fb45a5b314
@@ -227,19 +227,23 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
HAL.report(tResourceType.kResourceType_Language, tInstances.kLanguage_Java);
|
||||
|
||||
String robotName = "";
|
||||
Enumeration<URL> resources = null;
|
||||
try {
|
||||
resources = RobotBase.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
while (resources != null && resources.hasMoreElements()) {
|
||||
if (args.length > 0) {
|
||||
robotName = args[0];
|
||||
} else {
|
||||
Enumeration<URL> resources = null;
|
||||
try {
|
||||
Manifest manifest = new Manifest(resources.nextElement().openStream());
|
||||
robotName = manifest.getMainAttributes().getValue("Robot-Class");
|
||||
resources = RobotBase.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
while (resources != null && resources.hasMoreElements()) {
|
||||
try {
|
||||
Manifest manifest = new Manifest(resources.nextElement().openStream());
|
||||
robotName = manifest.getMainAttributes().getValue("Robot-Class");
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("********** Robot program starting **********");
|
||||
|
||||
Reference in New Issue
Block a user