blob: 7d2ea1d4de485de6138522cc2398ba5a58a1c3b8 [file] [log] [blame]
Brian Silverman8fce7482020-01-05 13:18:21 -08001/*----------------------------------------------------------------------------*/
Austin Schuh1e69f942020-11-14 15:06:14 -08002/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
Brian Silverman8fce7482020-01-05 13:18:21 -08003/* 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
15void frc::filesystem::GetLaunchDirectory(wpi::SmallVectorImpl<char>& result) {
16 wpi::sys::fs::current_path(result);
17}
18
19void frc::filesystem::GetOperatingDirectory(
20 wpi::SmallVectorImpl<char>& result) {
Austin Schuh1e69f942020-11-14 15:06:14 -080021 if constexpr (RobotBase::IsReal()) {
Brian Silverman8fce7482020-01-05 13:18:21 -080022 wpi::sys::path::native("/home/lvuser", result);
23 } else {
24 frc::filesystem::GetLaunchDirectory(result);
25 }
26}
27
28void frc::filesystem::GetDeployDirectory(wpi::SmallVectorImpl<char>& result) {
29 frc::filesystem::GetOperatingDirectory(result);
Austin Schuh1e69f942020-11-14 15:06:14 -080030 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 Silverman8fce7482020-01-05 13:18:21 -080037}