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
+3 -2
View File
@@ -31,6 +31,7 @@
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <algorithm>
#include <filesystem>
namespace openspace {
@@ -158,8 +159,8 @@ void DataProcessorKameleon::setDimensions(glm::size3_t dimensions) {
}
void DataProcessorKameleon::initializeKameleonWrapper(std::string path) {
const std::string& extension = ghoul::filesystem::File(absPath(path)).fileExtension();
if (FileSys.fileExists(absPath(path)) && extension == "cdf") {
std::filesystem::path extension = std::filesystem::path(absPath(path)).extension();
if (std::filesystem::is_regular_file(absPath(path)) && extension == ".cdf") {
if (_kw) {
_kw->close();
}
+8 -11
View File
@@ -42,6 +42,7 @@
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/constexpr.h>
#include <filesystem>
#include <fstream>
#include "iswamanager_lua.inl"
@@ -410,9 +411,8 @@ std::string IswaManager::parseKWToLuaTable(const CdfInfo& info, const std::strin
return "";
}
const std::string& extension =
ghoul::filesystem::File(absPath(info.path)).fileExtension();
if (extension == "cdf") {
std::filesystem::path ext = std::filesystem::path(absPath(info.path)).extension();
if (ext == ".cdf") {
KameleonWrapper kw = KameleonWrapper(absPath(info.path));
std::string parent = kw.parent();
@@ -587,10 +587,8 @@ void IswaManager::createSphere(MetadataFuture& data) {
}
void IswaManager::createKameleonPlane(CdfInfo info, std::string cut) {
const std::string& extension = ghoul::filesystem::File(
absPath(info.path)
).fileExtension();
if (FileSys.fileExists(absPath(info.path)) && extension == "cdf") {
std::filesystem::path ext = std::filesystem::path(absPath(info.path)).extension();
if (std::filesystem::is_regular_file(absPath(info.path)) && ext == ".cdf") {
if (!info.group.empty()) {
std::string type = typeid(KameleonPlane).name();
registerGroup(info.group, type);
@@ -628,9 +626,8 @@ void IswaManager::createKameleonPlane(CdfInfo info, std::string cut) {
void IswaManager::createFieldline(std::string name, std::string cdfPath,
std::string seedPath)
{
const std::string& ext = ghoul::filesystem::File(absPath(cdfPath)).fileExtension();
if (FileSys.fileExists(absPath(cdfPath)) && ext == "cdf") {
std::filesystem::path ext = std::filesystem::path(absPath(cdfPath)).extension();
if (std::filesystem::is_regular_file(absPath(cdfPath)) && ext == ".cdf") {
std::string luaTable = "{"
"Name = '" + name + "',"
"Parent = 'Earth',"
@@ -701,7 +698,7 @@ ghoul::Event<>& IswaManager::iswaEvent() {
void IswaManager::addCdfFiles(std::string cdfpath) {
cdfpath = absPath(cdfpath);
if (FileSys.fileExists(cdfpath)) {
if (std::filesystem::is_regular_file(cdfpath)) {
//std::string basePath = path.substr(0, path.find_last_of("/\\"));
std::ifstream jsonFile(cdfpath);