Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) 2018 FIRST. All Rights Reserved. */ |
| 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) { |
| 21 | if (RobotBase::IsReal()) { |
| 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); |
| 30 | wpi::sys::path::append(result, "deploy"); |
| 31 | } |