68 lines
2.7 KiB
Diff
68 lines
2.7 KiB
Diff
From 5b8799878ff4c2c7e889d466fa3491f7c7956f2e Mon Sep 17 00:00:00 2001
|
|
From: GH Cao <driver1998.ms@outlook.com>
|
|
Date: Sun, 20 Apr 2025 00:06:47 +0800
|
|
Subject: [PATCH 1/3] Workaround build error with libc++ with agi::fs::path
|
|
|
|
The `std::basic_fstream` implementation in libc++ does not allow constructing with a derived class of `std::filesystem::path` like `agi::fs::path`. (There is a `is_same_v` constraint.)
|
|
|
|
Workaround by getting its underly string manually.
|
|
|
|
This kind of defeat the purpose of `agi::fs::path`, therefore currently sent as draft.
|
|
---
|
|
libaegisub/common/io.cpp | 4 ++--
|
|
libaegisub/common/log.cpp | 2 +-
|
|
src/crash_writer_minidump.cpp | 2 +-
|
|
3 files changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/libaegisub/common/io.cpp b/libaegisub/common/io.cpp
|
|
index b7dce2564..2da982972 100644
|
|
--- a/libaegisub/common/io.cpp
|
|
+++ b/libaegisub/common/io.cpp
|
|
@@ -27,7 +27,7 @@ using namespace agi::fs;
|
|
std::unique_ptr<std::istream> Open(path const& file, bool binary) {
|
|
LOG_D("agi/io/open/file") << file;
|
|
|
|
- auto stream = std::make_unique<std::ifstream>(file, (binary ? std::ios::binary : std::ios::in));
|
|
+ auto stream = std::make_unique<std::ifstream>(file.string(), (binary ? std::ios::binary : std::ios::in));
|
|
if (stream->fail()) {
|
|
acs::CheckFileRead(file);
|
|
throw IOFatal("Unknown fatal error occurred opening " + file.string());
|
|
@@ -42,7 +42,7 @@ Save::Save(path const& file, bool binary)
|
|
{
|
|
LOG_D("agi/io/save/file") << file;
|
|
|
|
- fp = std::make_unique<std::ofstream>(tmp_name, binary ? std::ios::binary : std::ios::out);
|
|
+ fp = std::make_unique<std::ofstream>(tmp_name.string(), binary ? std::ios::binary : std::ios::out);
|
|
if (!fp->good()) {
|
|
acs::CheckDirWrite(file.parent_path());
|
|
acs::CheckFileWrite(file);
|
|
diff --git a/libaegisub/common/log.cpp b/libaegisub/common/log.cpp
|
|
index 96c04fd0f..b4b472636 100644
|
|
--- a/libaegisub/common/log.cpp
|
|
+++ b/libaegisub/common/log.cpp
|
|
@@ -98,7 +98,7 @@ Message::~Message() {
|
|
}
|
|
|
|
JsonEmitter::JsonEmitter(agi::fs::path const& directory)
|
|
-: fp(new std::ofstream(directory/util::strftime("%Y-%m-%d-%H-%M-%S.json")))
|
|
+: fp(new std::ofstream((directory/util::strftime("%Y-%m-%d-%H-%M-%S.json")).string()))
|
|
{
|
|
}
|
|
|
|
diff --git a/src/crash_writer_minidump.cpp b/src/crash_writer_minidump.cpp
|
|
index ae6e0b5ba..fdad53b56 100644
|
|
--- a/src/crash_writer_minidump.cpp
|
|
+++ b/src/crash_writer_minidump.cpp
|
|
@@ -137,7 +137,7 @@ void Write() {
|
|
}
|
|
|
|
void Write(std::string const& error) {
|
|
- std::ofstream file(crashlog_path, std::ios::app);
|
|
+ std::ofstream file(crashlog_path.string(), std::ios::app);
|
|
if (file.is_open()) {
|
|
file << agi::util::strftime("--- %y-%m-%d %H:%M:%S ------------------\n");
|
|
agi::format(file, "VER - %s\n", GetAegisubLongVersionString());
|
|
--
|
|
2.47.1.windows.2
|
|
|