Skip to content

Commit

Permalink
catch exception when saving texture
Browse files Browse the repository at this point in the history
  • Loading branch information
DubbleClick committed Dec 4, 2023
1 parent a72b423 commit c270ce5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion header/Defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct TextureFileStruct {
inline void Message(const char* format, ...)
{
#ifdef _DEBUG
#if 0
#if 1
va_list args;
va_start(args, format);
vprintf(format, args);
Expand Down
8 changes: 7 additions & 1 deletion modules/TextureFunction.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,13 @@ export namespace TextureFunction {
{
const auto file_name = std::format("0x{:x}.dds", entry.crc_hash);
const auto file_out = dll_path / "textures" / file_name;
std::filesystem::create_directory(file_out.parent_path());
try {
std::filesystem::create_directory(file_out.parent_path());
}
catch (const std::exception& e) {
Warning("ImageSave (%#lX%s): %s\n", entry.crc_hash, entry.ext.c_str(), e.what());
return;
}
if (!std::filesystem::exists(file_out)) {
const auto hr = DirectX::SaveToDDSFile(
image.GetImages(),
Expand Down

0 comments on commit c270ce5

Please sign in to comment.