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

@@ -255,17 +255,9 @@ static void DosExtract(const TCollection_AsciiString& what,
buffer.Remove(1,disk.Length()); // Removes <<disk:>>
}
if (buffer.Search(".") != -1){ // There is an extension to extract
ext = buffer.Token(".",2);
ext.Insert(1,'.'); // Prepends 'dot'
pos = buffer.Search("."); // Removes extension from buffer
if (pos != -1)
buffer.Remove(pos,ext.Length());
}
trek = buffer;
trek.ChangeAll('\\','|');
trek.ChangeAll('\\','|');
pos = trek.Search("..");
while (pos != -1){ // Changes every ".." by '^'
@@ -274,16 +266,20 @@ static void DosExtract(const TCollection_AsciiString& what,
pos = trek.Search("..");
}
pos = trek.SearchFromEnd("|"); // Extract name
pos = trek.SearchFromEnd ("|"); // Extract name
if (pos != -1) {
p = (Standard_PCharacter)trek.ToCString();
name = &p[pos];
trek.Remove(trek.Search(name),name.Length());
p = (Standard_PCharacter)trek.ToCString ();
name = &p[pos];
if (name.Length ()) trek.Remove (pos + 1, name.Length ());
}
else { // No '|' means no trek but a name
name = buffer;
trek = "";
name = buffer;
trek = "";
}
pos = name.SearchFromEnd (".");
if (pos != -1) // There is an extension to extract
ext = name.Split (pos - 1);
}