mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Revert "Switch to using std::filesystem (#1235)"
This reverts commit cf62ff772f.
Some functions used by this break on macOS before 10.15,
which we want to keep supporting.
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <fcntl.h>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <ios>
|
||||
#include <iostream>
|
||||
@@ -42,7 +41,7 @@ public:
|
||||
* This should only be called once, and before doing any `->` operations.
|
||||
* Returns `nullptr` on error, and a non-null pointer otherwise.
|
||||
*/
|
||||
File *open(std::filesystem::path const &path, std::ios_base::openmode mode) {
|
||||
File *open(std::string const &path, std::ios_base::openmode mode) {
|
||||
if (path != "-") {
|
||||
return _file.emplace<std::filebuf>().open(path, mode) ? this : nullptr;
|
||||
} else if (mode & std::ios_base::in) {
|
||||
@@ -86,11 +85,11 @@ public:
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
std::string string(std::filesystem::path const &path) const {
|
||||
return std::visit(Visitor{[&path](std::filebuf const &) { return path.string(); },
|
||||
char const *c_str(std::string const &path) const {
|
||||
return std::visit(Visitor{[&path](std::filebuf const &) { return path.c_str(); },
|
||||
[](std::streambuf const *buf) {
|
||||
return std::string{buf == std::cin.rdbuf()
|
||||
? "<stdin>" : "<stdout>"};
|
||||
return buf == std::cin.rdbuf()
|
||||
? "<stdin>" : "<stdout>";
|
||||
}},
|
||||
_file);
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
#define RGBDS_GFX_MAIN_HPP
|
||||
|
||||
#include <array>
|
||||
#include <filesystem>
|
||||
#include <limits.h>
|
||||
#include <optional>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -26,7 +24,7 @@ struct Options {
|
||||
bool columnMajor = false; // -Z, previously -h
|
||||
uint8_t verbosity = 0; // -v
|
||||
|
||||
std::optional<std::filesystem::path> attrmap{}; // -a, -A
|
||||
std::string attrmap{}; // -a, -A
|
||||
std::array<uint8_t, 2> baseTileIDs{0, 0}; // -b
|
||||
enum {
|
||||
NO_SPEC,
|
||||
@@ -43,14 +41,14 @@ struct Options {
|
||||
} inputSlice{0, 0, 0, 0}; // -L (margins in clockwise order, like CSS)
|
||||
std::array<uint16_t, 2> maxNbTiles{UINT16_MAX, 0}; // -N
|
||||
uint8_t nbPalettes = 8; // -n
|
||||
std::optional<std::filesystem::path> output{}; // -o
|
||||
std::optional<std::filesystem::path> palettes{}; // -p, -P
|
||||
std::optional<std::filesystem::path> palmap{}; // -q, -Q
|
||||
std::string output{}; // -o
|
||||
std::string palettes{}; // -p, -P
|
||||
std::string palmap{}; // -q, -Q
|
||||
uint8_t nbColorsPerPal = 0; // -s; 0 means "auto" = 1 << bitDepth;
|
||||
std::optional<std::filesystem::path> tilemap{}; // -t, -T
|
||||
std::string tilemap{}; // -t, -T
|
||||
uint64_t trim = 0; // -x
|
||||
|
||||
std::optional<std::filesystem::path> input{}; // positional arg
|
||||
std::string input{}; // positional arg
|
||||
|
||||
static constexpr uint8_t VERB_NONE = 0; // Normal, no extra output
|
||||
static constexpr uint8_t VERB_CFG = 1; // Print configuration after parsing options
|
||||
|
||||
Reference in New Issue
Block a user