From bcb0fd43962987f361b3f151d5779a70288e1eee Mon Sep 17 00:00:00 2001 From: VRO <> Date: Wed, 22 Feb 2012 07:38:15 +0000 Subject: [PATCH] 0022995: It is not possible to check presence of a document in OCAF session via IsInSession() on Windows --- src/TDocStd/TDocStd_Application.cxx | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/TDocStd/TDocStd_Application.cxx b/src/TDocStd/TDocStd_Application.cxx index be237fccaf..8caf85b93f 100755 --- a/src/TDocStd/TDocStd_Application.cxx +++ b/src/TDocStd/TDocStd_Application.cxx @@ -158,15 +158,26 @@ void TDocStd_Application::Close(const Handle(TDocStd_Document)& aDoc) Standard_Integer TDocStd_Application::IsInSession (const TCollection_ExtendedString& path) const { - Standard_Integer nbdoc = NbDocuments(); - Handle(TDocStd_Document) D; - for (Standard_Integer i = 1; i <= nbdoc; i++) { - GetDocument(i,D); - if (D->IsSaved()) { - if (path == D->GetPath()) return i; + TCollection_ExtendedString unifiedPath(path); + unifiedPath.ChangeAll('/', '|'); + unifiedPath.ChangeAll('\\', '|'); + + Standard_Integer nbdoc = NbDocuments(); + Handle(TDocStd_Document) D; + for (Standard_Integer i = 1; i <= nbdoc; i++) + { + GetDocument(i,D); + if (D->IsSaved()) + { + TCollection_ExtendedString unifiedDocPath(D->GetPath()); + unifiedDocPath.ChangeAll('/', '|'); + unifiedDocPath.ChangeAll('\\', '|'); + + if (unifiedPath == unifiedDocPath) + return i; + } } - } - return 0; + return 0; } //======================================================================= -- 2.39.5