1
0
mirror of synced 2024-11-24 15:50:16 +01:00

sys: Fixed more build issues

This commit is contained in:
WerWolv 2023-03-13 09:25:07 +01:00
parent 55f9faea10
commit 00a5fd2d7c
5 changed files with 16 additions and 23 deletions

View File

@ -17,6 +17,7 @@
#include <filesystem> #include <filesystem>
#include <wolv/io/file.hpp> #include <wolv/io/file.hpp>
#include <wolv/io/fs.hpp>
namespace hex::fs { namespace hex::fs {
@ -87,14 +88,7 @@ namespace hex::fs {
#elif defined(OS_MACOS) #elif defined(OS_MACOS)
std::fs::path applicationSupportDirPath; paths.push_back(wolv::io::fs::getApplicationSupportDirectoryPath());
{
auto string = getMacApplicationSupportDirectoryPath();
applicationSupportDirPath = std::string(string);
macFree(string);
}
paths.push_back(applicationSupportDirPath);
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
@ -110,7 +104,7 @@ namespace hex::fs {
#if defined(OS_MACOS) #if defined(OS_MACOS)
if (auto executablePath = fs::getExecutablePath(); executablePath.has_value()) if (auto executablePath = wolv::io::fs::getExecutablePath(); executablePath.has_value())
paths.push_back(*executablePath); paths.push_back(*executablePath);
#else #else

View File

@ -140,7 +140,7 @@
void initialize() { void initialize() {
if (auto executablePath = fs::getExecutablePath(); executablePath.has_value()) { if (auto executablePath = wolv::io::fs::getExecutablePath(); executablePath.has_value()) {
static std::string path = executablePath->string(); static std::string path = executablePath->string();
s_backtraceState = backtrace_create_state(path.c_str(), 1, [](void *, const char *msg, int) { log::error("{}", msg); }, nullptr); s_backtraceState = backtrace_create_state(path.c_str(), 1, [](void *, const char *msg, int) { log::error("{}", msg); }, nullptr);
} }

View File

@ -1,6 +1,5 @@
#include <hex/providers/provider.hpp> #include <hex/providers/provider.hpp>
#include <hex/helpers/file.hpp>
#include <hex/helpers/logger.hpp> #include <hex/helpers/logger.hpp>
#include <stdexcept> #include <stdexcept>
@ -48,7 +47,7 @@ namespace hex::test {
return this->m_data->size(); return this->m_data->size();
} }
[[nodiscard]] virtual std::string getTypeName() const { return "hex.test.provider.test"; } [[nodiscard]] virtual std::string getTypeName() const override { return "hex.test.provider.test"; }
bool open() override { return true; } bool open() override { return true; }
void close() override { } void close() override { }

View File

@ -1,6 +1,6 @@
#include <hex/test/tests.hpp> #include <hex/test/tests.hpp>
#include <hex/helpers/file.hpp> #include <wolv/io/file.hpp>
#include <hex/helpers/fs.hpp> #include <hex/helpers/fs.hpp>
using namespace std::literals::string_literals; using namespace std::literals::string_literals;
@ -12,21 +12,21 @@ TEST_SEQUENCE("FileAccess") {
std::fs::create_directories(FilePath.parent_path()); std::fs::create_directories(FilePath.parent_path());
{ {
hex::fs::File file(FilePath, hex::fs::File::Mode::Create); wolv::io::File file(FilePath, wolv::io::File::Mode::Create);
TEST_ASSERT(file.isValid()); TEST_ASSERT(file.isValid());
file.write(FileContent); file.write(FileContent);
} }
{ {
hex::fs::File file(FilePath, hex::fs::File::Mode::Read); wolv::io::File file(FilePath, wolv::io::File::Mode::Read);
TEST_ASSERT(file.isValid()); TEST_ASSERT(file.isValid());
TEST_ASSERT(file.readString() == FileContent); TEST_ASSERT(file.readString() == FileContent);
} }
{ {
hex::fs::File file(FilePath, hex::fs::File::Mode::Write); wolv::io::File file(FilePath, wolv::io::File::Mode::Write);
TEST_ASSERT(file.isValid()); TEST_ASSERT(file.isValid());
@ -35,7 +35,7 @@ TEST_SEQUENCE("FileAccess") {
} }
{ {
hex::fs::File file(FilePath, hex::fs::File::Mode::Read); wolv::io::File file(FilePath, wolv::io::File::Mode::Read);
if (file.isValid()) if (file.isValid())
TEST_FAIL(); TEST_FAIL();
} }
@ -50,21 +50,21 @@ TEST_SEQUENCE("UTF-8 Path") {
std::fs::create_directories(FilePath.parent_path()); std::fs::create_directories(FilePath.parent_path());
{ {
hex::fs::File file(FilePath, hex::fs::File::Mode::Create); wolv::io::File file(FilePath, wolv::io::File::Mode::Create);
TEST_ASSERT(file.isValid()); TEST_ASSERT(file.isValid());
file.write(FileContent); file.write(FileContent);
} }
{ {
hex::fs::File file(FilePath, hex::fs::File::Mode::Read); wolv::io::File file(FilePath, wolv::io::File::Mode::Read);
TEST_ASSERT(file.isValid()); TEST_ASSERT(file.isValid());
TEST_ASSERT(file.readU8String() == FileContent); TEST_ASSERT(file.readU8String() == FileContent);
} }
{ {
hex::fs::File file(FilePath, hex::fs::File::Mode::Write); wolv::io::File file(FilePath, wolv::io::File::Mode::Write);
TEST_ASSERT(file.isValid()); TEST_ASSERT(file.isValid());
@ -73,7 +73,7 @@ TEST_SEQUENCE("UTF-8 Path") {
} }
{ {
hex::fs::File file(FilePath, hex::fs::File::Mode::Read); wolv::io::File file(FilePath, wolv::io::File::Mode::Read);
if (file.isValid()) if (file.isValid())
TEST_FAIL(); TEST_FAIL();
} }

View File

@ -1,7 +1,7 @@
#include <hex/test/tests.hpp> #include <hex/test/tests.hpp>
#include <hex/helpers/net.hpp> #include <hex/helpers/net.hpp>
#include <hex/helpers/file.hpp> #include <wolv/io/file.hpp>
#include <hex/helpers/fs.hpp> #include <hex/helpers/fs.hpp>
using namespace std::literals::string_literals; using namespace std::literals::string_literals;
@ -43,7 +43,7 @@ TEST_SEQUENCE("ContentAPI") {
TEST_ASSERT(result.code == 200); TEST_ASSERT(result.code == 200);
hex::fs::File file(FilePath, hex::fs::File::Mode::Read); wolv::io::File file(FilePath, wolv::io::File::Mode::Read);
if (!file.isValid()) if (!file.isValid())
TEST_FAIL(); TEST_FAIL();