mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Fix the hack for File::c_str to work (#1242)
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
static DefaultInitVec<uint8_t> readInto(std::filesystem::path path) {
|
||||
File file;
|
||||
if (!file.open(path, std::ios::in | std::ios::binary)) {
|
||||
fatal("Failed to open \"%s\": %s", file.c_str(path), strerror(errno));
|
||||
fatal("Failed to open \"%s\": %s", file.string(path).c_str(), strerror(errno));
|
||||
}
|
||||
DefaultInitVec<uint8_t> data(128 * 16); // Begin with some room pre-allocated
|
||||
|
||||
@@ -144,7 +144,8 @@ void reverse() {
|
||||
if (options.palettes.has_value()) {
|
||||
File file;
|
||||
if (!file.open(*options.palettes, std::ios::in | std::ios::binary)) {
|
||||
fatal("Failed to open \"%s\": %s", file.c_str(*options.palettes), strerror(errno));
|
||||
fatal("Failed to open \"%s\": %s", file.string(*options.palettes).c_str(),
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
palettes.clear();
|
||||
@@ -231,12 +232,13 @@ void reverse() {
|
||||
options.verbosePrint(Options::VERB_LOG_ACT, "Writing image...\n");
|
||||
File pngFile;
|
||||
if (!pngFile.open(*options.input, std::ios::out | std::ios::binary)) {
|
||||
fatal("Failed to create \"%s\": %s", pngFile.c_str(*options.input), strerror(errno));
|
||||
fatal("Failed to create \"%s\": %s", pngFile.string(*options.input).c_str(),
|
||||
strerror(errno));
|
||||
}
|
||||
png_structp png = png_create_write_struct(
|
||||
PNG_LIBPNG_VER_STRING,
|
||||
const_cast<png_voidp>(static_cast<void const *>(pngFile.c_str(*options.input))), pngError,
|
||||
pngWarning);
|
||||
const_cast<png_voidp>(static_cast<void const *>(pngFile.string(*options.input).c_str())),
|
||||
pngError, pngWarning);
|
||||
if (!png) {
|
||||
fatal("Couldn't create PNG write struct: %s", strerror(errno));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user