Feature/filesystem cleanup (#1587)

* Adapting to the changes in Ghoul
* First step of moving filesystem functions to std
* Remove persistence flag from cachemanager
This commit is contained in:
Alexander Bock
2021-05-16 20:26:49 +02:00
committed by GitHub
parent 2ca7101b6c
commit ccdc5a5dc3
87 changed files with 648 additions and 711 deletions
@@ -29,8 +29,8 @@
#include <ghoul/logging/logmanager.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/filesystem/directory.h>
#include <ghoul/misc/dictionary.h>
#include <filesystem>
#include <fstream>
namespace {
@@ -67,10 +67,9 @@ InstrumentTimesParser::InstrumentTimesParser(std::string name, std::string seque
}
bool InstrumentTimesParser::create() {
using RawPath = ghoul::filesystem::Directory::RawPath;
ghoul::filesystem::Directory sequenceDir(_fileName, RawPath::Yes);
if (!FileSys.directoryExists(sequenceDir)) {
LERROR(fmt::format("Could not load Label Directory '{}'", sequenceDir.path()));
std::string sequenceDir = absPath(_fileName);
if (!std::filesystem::is_directory(sequenceDir)) {
LERROR(fmt::format("Could not load Label Directory '{}'", sequenceDir));
return false;
}
@@ -79,12 +78,9 @@ bool InstrumentTimesParser::create() {
for (const std::pair<const K, V>& p : _instrumentFiles) {
const std::string& instrumentID = p.first;
for (std::string filename : p.second) {
std::string filepath = FileSys.pathByAppendingComponent(
sequenceDir.path(),
std::move(filename)
);
std::string filepath = fmt::format("{}/{}", sequenceDir, std::move(filename));
if (!FileSys.fileExists(filepath)) {
if (!std::filesystem::is_regular_file(filepath)) {
LERROR(fmt::format("Unable to read file '{}'. Skipping file", filepath));
continue;
}