Files
allwpilib/wpilibc/src/main/native/include/frc/Filesystem.h
Peter Johnson fe570e000c [wpiutil] Replace llvm filesystem with C++17 filesystem (#3401)
Use ghc::filesystem as fill on older GCC (e.g. RoboRIO).
This can be removed once all GCC platforms have upgraded to 8.1 or later.

File open functionality has been retained from LLVM but moved to "fs" namespace
and tweaked for improved consistency with std::filesystem (e.g. error_code is
passed by reference instead of returned).

Also update WPILibC's Filesystem functions to return std::string.
2021-06-01 21:50:35 -07:00

40 lines
1.2 KiB
C++

// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <string>
/** WPILib FileSystem namespace */
namespace frc::filesystem {
/**
* Obtains the current working path that the program was launched with.
* This is analogous to the `pwd` command on unix.
*
* @return The result of the current working path lookup.
*/
std::string GetLaunchDirectory();
/**
* Obtains the operating directory of the program. On the roboRIO, this
* is /home/lvuser. In simulation, it is where the simulation was launched
* from (`pwd`).
*
* @return The result of the operating directory lookup.
*/
std::string GetOperatingDirectory();
/**
* 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 "src/main/deploy" (`pwd`/src/main/deploy).
*
* @return The result of the operating directory lookup
*/
std::string GetDeployDirectory();
} // namespace frc::filesystem