mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[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.
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
|
||||
#include <hal/DriverStation.h>
|
||||
#include <hal/HALBase.h>
|
||||
#include <wpi/Path.h>
|
||||
#include <wpi/StackTrace.h>
|
||||
#include <wpi/fs.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -24,10 +24,11 @@ RuntimeError::RuntimeError(int32_t code, std::string&& loc, std::string&& stack,
|
||||
RuntimeError::RuntimeError(int32_t code, const char* fileName, int lineNumber,
|
||||
const char* funcName, std::string&& stack,
|
||||
std::string&& message)
|
||||
: RuntimeError{code,
|
||||
fmt::format("{} [{}:{}]", funcName,
|
||||
wpi::sys::path::filename(fileName), lineNumber),
|
||||
std::move(stack), std::move(message)} {}
|
||||
: RuntimeError{
|
||||
code,
|
||||
fmt::format("{} [{}:{}]", funcName,
|
||||
fs::path{fileName}.filename().string(), lineNumber),
|
||||
std::move(stack), std::move(message)} {}
|
||||
|
||||
void RuntimeError::Report() const {
|
||||
HAL_SendError(m_data->code < 0, m_data->code, 0, what(), m_data->loc.c_str(),
|
||||
|
||||
Reference in New Issue
Block a user