Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/ |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame^] | 2 | /* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */ |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ |
| 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ |
| 5 | /* the project. */ |
| 6 | /*----------------------------------------------------------------------------*/ |
| 7 | |
| 8 | #include "frc/Filesystem.h" |
| 9 | |
| 10 | #include <wpi/FileSystem.h> |
| 11 | #include <wpi/Path.h> |
| 12 | |
| 13 | #include "frc/RobotBase.h" |
| 14 | |
| 15 | void frc::filesystem::GetLaunchDirectory(wpi::SmallVectorImpl<char>& result) { |
| 16 | wpi::sys::fs::current_path(result); |
| 17 | } |
| 18 | |
| 19 | void frc::filesystem::GetOperatingDirectory( |
| 20 | wpi::SmallVectorImpl<char>& result) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame^] | 21 | if constexpr (RobotBase::IsReal()) { |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 22 | wpi::sys::path::native("/home/lvuser", result); |
| 23 | } else { |
| 24 | frc::filesystem::GetLaunchDirectory(result); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | void frc::filesystem::GetDeployDirectory(wpi::SmallVectorImpl<char>& result) { |
| 29 | frc::filesystem::GetOperatingDirectory(result); |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame^] | 30 | if constexpr (RobotBase::IsReal()) { |
| 31 | wpi::sys::path::append(result, "deploy"); |
| 32 | } else { |
| 33 | wpi::sys::path::append(result, "src"); |
| 34 | wpi::sys::path::append(result, "main"); |
| 35 | wpi::sys::path::append(result, "deploy"); |
| 36 | } |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 37 | } |