From a837281079ce32070c013cf7047182ea37049515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Delgado=20Kr=C3=A4mer?= Date: Sat, 18 May 2024 12:47:08 +0200 Subject: [PATCH] Improve error logging related to asset resolution --- src/libguc/src/cgltf_util.cpp | 6 +++++- src/libguc/src/image.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/libguc/src/cgltf_util.cpp b/src/libguc/src/cgltf_util.cpp index 1a7ef37..9713d2f 100644 --- a/src/libguc/src/cgltf_util.cpp +++ b/src/libguc/src/cgltf_util.cpp @@ -69,20 +69,24 @@ namespace detail ArResolvedPath resolvedPath = resolver.Resolve(path); if (!resolvedPath) { + TF_RUNTIME_ERROR("unable to resolve %s", path); return cgltf_result_file_not_found; } - TF_DEBUG(GUC).Msg("resolved path to %s\n", resolvedPath.GetPathString().c_str()); + std::string resolvedPathStr = resolvedPath.GetPathString(); + TF_DEBUG(GUC).Msg("resolved path to %s\n", resolvedPathStr.c_str()); std::shared_ptr asset = resolver.OpenAsset(ArResolvedPath(path)); if (!asset) { + TF_RUNTIME_ERROR("unable to open asset %s", resolvedPathStr.c_str()); return cgltf_result_file_not_found; } std::shared_ptr buffer = asset->GetBuffer(); if (!buffer) { + TF_RUNTIME_ERROR("unable to open buffer for %s", resolvedPathStr.c_str()); return cgltf_result_io_error; } diff --git a/src/libguc/src/image.cpp b/src/libguc/src/image.cpp index 70f46a7..e589b76 100644 --- a/src/libguc/src/image.cpp +++ b/src/libguc/src/image.cpp @@ -119,20 +119,24 @@ namespace detail ArResolvedPath resolvedPath = resolver.Resolve(path); if (!resolvedPath) { + TF_RUNTIME_ERROR("unable to resolve %s", path); return false; } - TF_DEBUG(GUC).Msg("resolved image to %s\n", resolvedPath.GetPathString().c_str()); + std::string resolvedPathStr = resolvedPath.GetPathString(); + TF_DEBUG(GUC).Msg("resolved image to %s\n", resolvedPathStr.c_str()); std::shared_ptr asset = resolver.OpenAsset(resolvedPath); if (!asset) { + TF_RUNTIME_ERROR("unable to open asset %s", resolvedPathStr.c_str()); return false; } std::shared_ptr buffer = asset->GetBuffer(); if (!buffer) { + TF_RUNTIME_ERROR("unable to open buffer for %s", resolvedPathStr.c_str()); return false; }