| 173 | } |
| 174 | |
| 175 | void OutputStream::writeKTX2(ktxTexture* texture, Reporter& report) { |
| 176 | const auto ret = ktxTexture_WriteToStdioStream(texture, file); |
| 177 | if (KTX_SUCCESS != ret) { |
| 178 | if (file != stdout) |
| 179 | std::filesystem::remove(DecodeUTF8Path(filepath).c_str()); |
| 180 | report.fatal(rc::IO_FAILURE, "Failed to write KTX file \"{}\": KTX error: {}.", filepath, ktxErrorString(ret)); |
| 181 | } |
| 182 | |
| 183 | // TODO: Investigate and resolve the portability issue with the C++ streams. The issue will most likely |
| 184 | // be in StreambufStream's position reporting and seeking. Currently a fallback is implemented in C above. |
| 185 | // StreambufStream<std::streambuf*> stream(activeStream->rdbuf(), std::ios::in | std::ios::binary); |
| 186 | // const auto ret = ktxTexture_WriteToStream(texture, stream.stream()); |
| 187 | // |
| 188 | // if (KTX_SUCCESS != ret) { |
| 189 | // if (activeStream != &std::cout) |
| 190 | // std::filesystem::remove(DecodeUTF8Path(filepath).c_str()); |
| 191 | // report.fatal(rc::IO_FAILURE, "Failed to write KTX file \"{}\": {}.", fmtOutFile(filepath), ktxErrorString(ret)); |
| 192 | // } |
| 193 | } |
| 194 | |
| 195 | // ------------------------------------------------------------------------------------------------- |
| 196 |
no test coverage detected