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

0027849: ResourceManager path computations fail for the folders containing dots

Treatment of paths in Resource_Manager is corrected to handle properly paths with dots inside.
Extraction of extension from path in DOS mode when working on Linux is corrected in OSD_Path.
Test case added.
This commit is contained in:
razmyslovich
2016-09-08 10:09:12 +02:00
committed by apn
parent ebcbd82410
commit f9ac4dc9ab
4 changed files with 84 additions and 21 deletions

View File

@@ -61,8 +61,12 @@ Resource_Manager::Resource_Manager(const Standard_CString aName,
{
if ( !aDefaultsDirectory.IsEmpty() ) {
OSD_Path anOSDPath(aDefaultsDirectory);
anOSDPath.DownTrek(anOSDPath.Name());
if (!anOSDPath.Name().IsEmpty())
{
anOSDPath.DownTrek (anOSDPath.Name () + anOSDPath.Extension ());
}
anOSDPath.SetName(aName);
anOSDPath.SetExtension("");
TCollection_AsciiString aPath;
anOSDPath.SystemName(aPath);
Load(aPath,myRefMap);
@@ -73,8 +77,12 @@ Resource_Manager::Resource_Manager(const Standard_CString aName,
if ( !anUserDefaultsDirectory.IsEmpty() ) {
OSD_Path anOSDPath(anUserDefaultsDirectory);
anOSDPath.DownTrek(anOSDPath.Name());
if (!anOSDPath.Name().IsEmpty())
{
anOSDPath.DownTrek (anOSDPath.Name () + anOSDPath.Extension ());
}
anOSDPath.SetName(aName);
anOSDPath.SetExtension("");
TCollection_AsciiString aPath;
anOSDPath.SystemName(aPath);
Load(aPath,myRefMap);
@@ -267,8 +275,12 @@ Standard_Boolean Resource_Manager::Save() const
}
}
anOSDPath.DownTrek(anOSDPath.Name());
if (!anOSDPath.Name().IsEmpty())
{
anOSDPath.DownTrek (anOSDPath.Name () + anOSDPath.Extension ());
}
anOSDPath.SetName(myName);
anOSDPath.SetExtension("");
anOSDPath.SystemName(aFilePath);
OSD_File File = anOSDPath;
@@ -496,10 +508,10 @@ void Resource_Manager::GetResourcePath (TCollection_AsciiString& aPath, const St
if (!anOSDPath.Name().IsEmpty())
{
anOSDPath.DownTrek(anOSDPath.Name());
anOSDPath.DownTrek (anOSDPath.Name () + anOSDPath.Extension ());
}
anOSDPath.SetName(aName);
anOSDPath.SetName (aName);
anOSDPath.SetExtension ("");
anOSDPath.SystemName(aPath);
}