Inlcude a file with paths as depedencies in GradleRio

Hey all!
This year we’re using GradleRio to build both our framework and robot code. We also want to load paths into pathfinder from a file on the rio. Is there a way for us to include our path files as dependencies in gradle so that we don’t have to put them on the rio by ftp? Thanks!

Here’s our build file https://github.com/team1389/New-Liftzilla/blob/master/build.gradle

You can add the files to your resources directory (“src/main/java/com/team1389”) to include them in the JAR. Since pathfinder doesn’t seem to be able to read URLs, you’ll have to extract them to a file, then pass that file as a parameter to pathfinder.


public static Trajectory readTrajectory(String trajectoryName) {
  try {
    Path extractionPath = Files.createTempFile("trajectory", ".csv");
    Files.copy(Robot.class.getResourceAsStream("/com/team1389/" + trajectoryName + ".csv"), extractionPath);
    return Pathfinder.readFromCsv(extractionPath.toFile());
  } catch (IOException e) {
    // Handle it how you want
  } 
}

You can also choose to send your paths over directly if you don’t want them in your .jar file, like so, but replacing project(":common") with project. This will place them in /home/lvuser/paths

That was the perfect solution, thank you!