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

View File

@@ -38,6 +38,7 @@
#include <ghoul/lua/ghoul_lua.h>
#include <ghoul/misc/dictionary.h>
#include <ghoul/ghoul.h>
#include <filesystem>
#include <iostream>
int main(int argc, char** argv) {
@@ -54,17 +55,20 @@ int main(int argc, char** argv) {
// to make it possible to find other files in the same directory.
FileSys.registerPathToken(
"${BIN}",
ghoul::filesystem::File(absPath(argv[0])).directoryName(),
std::filesystem::path(argv[0]).parent_path(),
ghoul::filesystem::FileSystem::Override::Yes
);
std::string configFile = configuration::findConfiguration();
std::filesystem::path configFile = configuration::findConfiguration();
// Register the base path as the directory where 'filename' lives
std::string base = ghoul::filesystem::File(configFile).directoryName();
std::filesystem::path base = configFile.parent_path();
constexpr const char* BasePathToken = "${BASE}";
FileSys.registerPathToken(BasePathToken, base);
*global::configuration = configuration::loadConfigurationFromFile(configFile, "");
*global::configuration = configuration::loadConfigurationFromFile(
configFile.string(),
""
);
global::openSpaceEngine->registerPathTokens();
global::openSpaceEngine->initialize();

View File

@@ -57,7 +57,7 @@ TEST_CASE("AssetLoader: Assertion", "[assetloader]") {
openspace::AssetLoader assetLoader(
state,
&syncWatcher,
FileSys.absolutePath("${TESTDIR}/AssetLoaderTest/")
absPath("${TESTDIR}/AssetLoaderTest/")
);
REQUIRE_NOTHROW(assetLoader.add("passassertion"));
@@ -71,7 +71,7 @@ TEST_CASE("AssetLoader: Basic Export Import", "[assetloader]") {
openspace::AssetLoader assetLoader(
state,
&syncWatcher,
FileSys.absolutePath("${TESTDIR}/AssetLoaderTest/")
absPath("${TESTDIR}/AssetLoaderTest/")
);
REQUIRE_NOTHROW(assetLoader.add("require"));
@@ -84,7 +84,7 @@ TEST_CASE("AssetLoader: Asset Functions", "[assetloader]") {
openspace::AssetLoader assetLoader(
state,
&syncWatcher,
FileSys.absolutePath("${TESTDIR}/AssetLoaderTest/")
absPath("${TESTDIR}/AssetLoaderTest/")
);
REQUIRE_NOTHROW(assetLoader.add("assetfunctionsexist"));
@@ -97,7 +97,7 @@ TEST_CASE("AssetLoader: Asset Initialization", "[assetloader]") {
openspace::AssetLoader assetLoader(
state,
&syncWatcher,
FileSys.absolutePath("${TESTDIR}/AssetLoaderTest/")
absPath("${TESTDIR}/AssetLoaderTest/")
);
bool passed;

View File

@@ -30,6 +30,7 @@
#include <ghoul/lua/ghoul_lua.h>
#include <ghoul/lua/luastate.h>
#include <ghoul/lua/lua_helper.h>
#include <filesystem>
TEST_CASE("CreateSingleColorImage: Create image and check return value",
"[createsinglecolorimage]")
@@ -126,7 +127,7 @@ TEST_CASE("CreateSingleColorImage: Check if file was created",
CHECK(res == 1);
std::string path = ghoul::lua::value<std::string>(L, 1);
CHECK(FileSys.fileExists(path));
CHECK(std::filesystem::is_regular_file(path));
}
TEST_CASE("CreateSingleColorImage: Load created image", "[createsinglecolorimage]") {