From 6869e4807ccd44f93fac992ca144a2bc351efa19 Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Tue, 8 Jul 2025 15:16:16 -0400 Subject: [PATCH] Make file.hpp independent of gfx (#1733) --- include/file.hpp | 8 +------- src/gfx/pal_spec.cpp | 3 ++- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/include/file.hpp b/include/file.hpp index bba1fdf0..4b73451c 100644 --- a/include/file.hpp +++ b/include/file.hpp @@ -15,8 +15,6 @@ #include "helpers.hpp" // assume #include "platform.hpp" -#include "gfx/warning.hpp" - class File { std::variant _file; @@ -32,11 +30,7 @@ public: assume(!(mode & std::ios_base::out)); _file.emplace(std::cin.rdbuf()); if (setmode(STDIN_FILENO, (mode & std::ios_base::binary) ? O_BINARY : O_TEXT) == -1) { - fatal( - "Failed to set stdin to %s mode: %s", - mode & std::ios_base::binary ? "binary" : "text", - strerror(errno) - ); + return nullptr; } } else { assume(mode & std::ios_base::out); diff --git a/src/gfx/pal_spec.cpp b/src/gfx/pal_spec.cpp index 8998415f..00623c71 100644 --- a/src/gfx/pal_spec.cpp +++ b/src/gfx/pal_spec.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -612,7 +613,7 @@ void parseExternalPalSpec(char const *arg) { std::filebuf file; // Some parsers read the file in text mode, others in binary mode if (!file.open(path, std::ios::in | std::get<2>(*iter))) { - error("Failed to open palette file \"%s\"", path); + fatal("Failed to open palette file \"%s\": %s", path, strerror(errno)); return; }