[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:
Peter Johnson
2021-06-01 21:50:35 -07:00
committed by GitHub
parent 01dc0249de
commit fe570e000c
25 changed files with 6757 additions and 3538 deletions

View File

@@ -4,9 +4,9 @@
#include "Instance.h"
#include <wpi/Path.h>
#include <wpi/SmallString.h>
#include <wpi/StringRef.h>
#include <wpi/fs.h>
#include <wpi/raw_ostream.h>
using namespace cs;
@@ -31,7 +31,7 @@ static void def_log_func(unsigned int level, const char* file,
} else {
return;
}
oss << "CS: " << levelmsg << msg << " (" << wpi::sys::path::filename(file)
oss << "CS: " << levelmsg << msg << " (" << fs::path{file}.filename().string()
<< ':' << line << ")\n";
wpi::errs() << oss.str();
}