Fixed a possible startup crash with a non-ANSI Documents path via a Clib fix

This commit is contained in:
Eddoursul 2026-11-15 19:01:51 +01:00
parent 6c33829ccd
commit 4a4b2a3b50
6 changed files with 5 additions and 29 deletions

View File

@ -149,7 +149,7 @@ message(STATUS "Fetching CommonLibSSE-GG...")
FetchContent_Declare( FetchContent_Declare(
CommonLibSSE CommonLibSSE
GIT_REPOSITORY https://github.com/eddoursul/CommonLibSSE-GG GIT_REPOSITORY https://github.com/eddoursul/CommonLibSSE-GG
GIT_TAG ff1a91b895af60fe7412b66544dfc4bce64c7286 GIT_TAG 5507da62fef3853b15e6285f9a758b17c58f95b7
) )
FetchContent_MakeAvailable(CommonLibSSE) FetchContent_MakeAvailable(CommonLibSSE)

View File

@ -59,7 +59,7 @@ namespace {
path /= "SKSE"sv; path /= "SKSE"sv;
path /= "EnderalSE.log"sv; path /= "EnderalSE.log"sv;
auto sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(path.string(), true); auto sink = logger::file_sink(path);
auto log = std::make_shared<spdlog::logger>("global log"s, std::move(sink)); auto log = std::make_shared<spdlog::logger>("global log"s, std::move(sink));
log->set_level(spdlog::level::info); log->set_level(spdlog::level::info);

View File

@ -9,7 +9,6 @@
#include <ShlObj_core.h> #include <ShlObj_core.h>
#undef cdecl // Workaround for Clang 14 CMake configure error. #undef cdecl // Workaround for Clang 14 CMake configure error.
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/msvc_sink.h> #include <spdlog/sinks/msvc_sink.h>
#include <xbyak/xbyak.h> #include <xbyak/xbyak.h>

View File

@ -157,7 +157,7 @@ message(STATUS "Fetching CommonLibSSE-GG...")
FetchContent_Declare( FetchContent_Declare(
CommonLibSSE CommonLibSSE
GIT_REPOSITORY https://github.com/eddoursul/CommonLibSSE-GG GIT_REPOSITORY https://github.com/eddoursul/CommonLibSSE-GG
GIT_TAG ff1a91b895af60fe7412b66544dfc4bce64c7286 GIT_TAG 5507da62fef3853b15e6285f9a758b17c58f95b7
) )
FetchContent_MakeAvailable(CommonLibSSE) FetchContent_MakeAvailable(CommonLibSSE)

View File

@ -5,40 +5,18 @@
using namespace SKSE; using namespace SKSE;
namespace {
void InitializeLogging() {
auto path = logger::log_directory();
if (!path) {
SKSE::stl::report_and_fail("Failed to find standard logging directory"sv);
}
*path /= "EnderalSteam.log"sv;
auto sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(path->string(), true);
auto log = std::make_shared<spdlog::logger>("global log"s, std::move(sink));
log->set_level(spdlog::level::info);
log->flush_on(spdlog::level::info);
spdlog::set_default_logger(std::move(log));
spdlog::set_pattern("[%l] %v"s);
}
}
SKSEPluginLoad(const LoadInterface* skse) { SKSEPluginLoad(const LoadInterface* skse) {
GetLoadInterface(skse); GetLoadInterface(skse);
InitializeLogging(); // Also opens EnderalSteam.log, through SKSE::log::init()
Init(skse);
auto* plugin = PluginDeclaration::GetSingleton(); auto* plugin = PluginDeclaration::GetSingleton();
auto version = plugin->GetVersion(); auto version = plugin->GetVersion();
logger::info("{} {} is loading...", plugin->GetName(), version); logger::info("{} {} is loading...", plugin->GetName(), version);
logger::info("Built against Steamworks SDK {}", ENDERAL_STEAM_SDK); logger::info("Built against Steamworks SDK {}", ENDERAL_STEAM_SDK);
Init(skse);
// SDK 1.55: has to happen here, not from a game event: the game opens its own Steam session // SDK 1.55: has to happen here, not from a game event: the game opens its own Steam session
// from BSWin32SystemUtility during WinMain, and whichever session is opened first // from BSWin32SystemUtility during WinMain, and whichever session is opened first
// decides which AppID the process stays registered as. // decides which AppID the process stays registered as.

View File

@ -104,7 +104,6 @@
#include <Psapi.h> #include <Psapi.h>
#undef cdecl // Workaround for Clang 14 CMake configure error. #undef cdecl // Workaround for Clang 14 CMake configure error.
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/msvc_sink.h> #include <spdlog/sinks/msvc_sink.h>
// Compatible declarations with other sample projects. // Compatible declarations with other sample projects.