Skip to content

Commit

Permalink
print sanitized name in warnings and info messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Eisenwave committed Mar 13, 2021
1 parent 6b0bde1 commit 356e261
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,21 +334,22 @@ std::optional<Texture> loadTexture(const std::string &name, const std::string &m
std::replace(sanitizedName.begin(), sanitizedName.end(), '\\', '/');
std::optional<FileInputStream> stream = FileInputStream::open(sanitizedName, OpenMode::BINARY);
if (not stream.has_value()) {
VXIO_LOG(WARNING, "Failed to open texture file \"" + name + "\" of material \"" + material + '"');
VXIO_LOG(WARNING, "Failed to open texture file \"" + sanitizedName + "\" of material \"" + material + '"');
return std::nullopt;
}

std::string err;
std::optional<Image> image = voxelio::png::decode(*stream, 4, err);
if (not image.has_value()) {
VXIO_LOG(WARNING, "Could open, but failed to decode texture \"" + name + "\" of material \"" + material + '"');
VXIO_LOG(WARNING,
"Could open, but failed to decode texture \"" + sanitizedName + "\" of material \"" + material + '"');
VXIO_LOG(WARNING, "Caused by STBI error: " + err);
return std::nullopt;
}
VXIO_ASSERT(err.empty());
image->setWrapMode(WrapMode::REPEAT);

VXIO_LOG(INFO, "Loaded texture \"" + name + "\"");
VXIO_LOG(INFO, "Loaded texture \"" + sanitizedName + "\"");
return Texture{std::move(*image)};
}

Expand Down

0 comments on commit 356e261

Please sign in to comment.