From 6f183ebdb07907f84f80dd44834f73ff9b10c2e1 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 18 May 2021 08:50:34 -0400 Subject: [PATCH 1/2] MAYA-105710: fix USD file fails to load on mapped mounted volume. --- lib/mayaUsd/utils/utilFileSystem.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/mayaUsd/utils/utilFileSystem.cpp b/lib/mayaUsd/utils/utilFileSystem.cpp index a42d60b0dd..13a1e216f7 100644 --- a/lib/mayaUsd/utils/utilFileSystem.cpp +++ b/lib/mayaUsd/utils/utilFileSystem.cpp @@ -143,23 +143,24 @@ std::string UsdMayaUtilFileSystem::resolveRelativePathWithinMayaContext( const MObject& proxyShape, const std::string& relativeFilePath) { - if (relativeFilePath.length() < 3) + if (relativeFilePath.length() < 3) { return relativeFilePath; + } std::string currentFileDir = getMayaReferencedFileDir(proxyShape); - if (currentFileDir.empty()) + if (currentFileDir.empty()) { currentFileDir = getMayaSceneFileDir(); + } - if (currentFileDir.empty()) + if (currentFileDir.empty()) { return relativeFilePath; + } - std::error_code errorCode; - auto path = ghc::filesystem::canonical( - ghc::filesystem::path(currentFileDir).append(relativeFilePath), errorCode); + auto path = ghc::filesystem::path(currentFileDir).append(relativeFilePath); - if (errorCode) { - // file does not exist + // if file does not exist + if (path.empty()) { return std::string(); } From 6bd91341fc9f235a0d62b7322dd58083e5a2e1c1 Mon Sep 17 00:00:00 2001 From: Hamed Sabri Date: Tue, 25 May 2021 10:49:42 -0400 Subject: [PATCH 2/2] - Switched to gulark v 1.5.6 which fixes the bug in ghc::filesystem::canonical - Revert back changes to use ghc::filesystem::canonical again. --- cmake/gulark.cmake | 2 +- lib/mayaUsd/utils/utilFileSystem.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/gulark.cmake b/cmake/gulark.cmake index 8710a9d76c..b19b941d84 100644 --- a/cmake/gulark.cmake +++ b/cmake/gulark.cmake @@ -38,7 +38,7 @@ else() FetchContent_Declare( ${CONTENT_NAME} GIT_REPOSITORY https://github.com/gulrak/filesystem.git - GIT_TAG 3d3c02ce35dcc68b5ebb34f21cb1fc507be9a66e + GIT_TAG 4e21ab305794f5309a1454b4ae82ab9a0f5e0d25 USES_TERMINAL_DOWNLOAD TRUE GIT_CONFIG advice.detachedHead=false ) diff --git a/lib/mayaUsd/utils/utilFileSystem.cpp b/lib/mayaUsd/utils/utilFileSystem.cpp index 13a1e216f7..884c6192ea 100644 --- a/lib/mayaUsd/utils/utilFileSystem.cpp +++ b/lib/mayaUsd/utils/utilFileSystem.cpp @@ -157,10 +157,12 @@ std::string UsdMayaUtilFileSystem::resolveRelativePathWithinMayaContext( return relativeFilePath; } - auto path = ghc::filesystem::path(currentFileDir).append(relativeFilePath); + std::error_code errorCode; + auto path = ghc::filesystem::canonical( + ghc::filesystem::path(currentFileDir).append(relativeFilePath), errorCode); - // if file does not exist - if (path.empty()) { + if (errorCode) { + // file does not exist return std::string(); }