From: VRO <> Date: Wed, 22 Feb 2012 07:38:15 +0000 (+0000) Subject: 0022995: It is not possible to check presence of a document in OCAF session via IsInS... X-Git-Tag: V6_5_3_beta1~77 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=bcb0fd43962987f361b3f151d5779a70288e1eee;p=occt-copy.git 0022995: It is not possible to check presence of a document in OCAF session via IsInSession() on Windows --- 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; } //=======================================================================