Change sim Filesystem.getDeployDirectory() to src/main/deploy (#2293)

This commit is contained in:
Peter Johnson
2020-01-19 16:34:45 -08:00
committed by GitHub
parent 02fb850761
commit d0cf4e8882
3 changed files with 19 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -18,7 +18,7 @@ void frc::filesystem::GetLaunchDirectory(wpi::SmallVectorImpl<char>& result) {
void frc::filesystem::GetOperatingDirectory(
wpi::SmallVectorImpl<char>& result) {
if (RobotBase::IsReal()) {
if constexpr (RobotBase::IsReal()) {
wpi::sys::path::native("/home/lvuser", result);
} else {
frc::filesystem::GetLaunchDirectory(result);
@@ -27,5 +27,11 @@ void frc::filesystem::GetOperatingDirectory(
void frc::filesystem::GetDeployDirectory(wpi::SmallVectorImpl<char>& result) {
frc::filesystem::GetOperatingDirectory(result);
wpi::sys::path::append(result, "deploy");
if constexpr (RobotBase::IsReal()) {
wpi::sys::path::append(result, "deploy");
} else {
wpi::sys::path::append(result, "src");
wpi::sys::path::append(result, "main");
wpi::sys::path::append(result, "deploy");
}
}

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -34,7 +34,7 @@ void GetOperatingDirectory(wpi::SmallVectorImpl<char>& result);
* Obtains the deploy directory of the program, which is the remote location
* src/main/deploy is deployed to by default. On the roboRIO, this is
* /home/lvuser/deploy. In simulation, it is where the simulation was launched
* from, in the subdirectory "deploy" (`pwd`/deploy).
* from, in the subdirectory "src/main/deploy" (`pwd`/src/main/deploy).
*
* @param result The result of the operating directory lookup
*/

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -48,11 +48,16 @@ public final class Filesystem {
* Obtains the deploy directory of the program, which is the remote location
* src/main/deploy is deployed to by default. On the roboRIO, this is
* /home/lvuser/deploy. In simulation, it is where the simulation was launched
* from, in the subdirectory "deploy" (`pwd`/deploy).
* from, in the subdirectory "src/main/deploy" (`pwd`/src/main/deploy).
*
* @return The deploy directory
*/
public static File getDeployDirectory() {
return new File(getOperatingDirectory(), "deploy");
if (RobotBase.isReal()) {
return new File(getOperatingDirectory(), "deploy");
} else {
return new File(getOperatingDirectory(), "src" + File.separator + "main"
+ File.separator + "deploy");
}
}
}