1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0022995: It is not possible to check presence of a document in OCAF session via IsInSession() on Windows

This commit is contained in:
VRO 2012-02-22 07:38:15 +00:00 committed by bugmaster
parent 9f446594d7
commit bcb0fd4396

View File

@ -158,12 +158,23 @@ void TDocStd_Application::Close(const Handle(TDocStd_Document)& aDoc)
Standard_Integer TDocStd_Application::IsInSession (const TCollection_ExtendedString& path) const Standard_Integer TDocStd_Application::IsInSession (const TCollection_ExtendedString& path) const
{ {
TCollection_ExtendedString unifiedPath(path);
unifiedPath.ChangeAll('/', '|');
unifiedPath.ChangeAll('\\', '|');
Standard_Integer nbdoc = NbDocuments(); Standard_Integer nbdoc = NbDocuments();
Handle(TDocStd_Document) D; Handle(TDocStd_Document) D;
for (Standard_Integer i = 1; i <= nbdoc; i++) { for (Standard_Integer i = 1; i <= nbdoc; i++)
{
GetDocument(i,D); GetDocument(i,D);
if (D->IsSaved()) { if (D->IsSaved())
if (path == D->GetPath()) return i; {
TCollection_ExtendedString unifiedDocPath(D->GetPath());
unifiedDocPath.ChangeAll('/', '|');
unifiedDocPath.ChangeAll('\\', '|');
if (unifiedPath == unifiedDocPath)
return i;
} }
} }
return 0; return 0;