The code is simplified - it checks the last character and if it is a folder separator, it removes it.
Modified file:
- CDF_Store.cxx, the method SetFolder().
0032785: Application Framework - CDF_Store::SetFolder incorrectly processes relative paths on Linux
The code is simplified - it checks the last character and if it is a folder separator, it removes it.
Modified file:
- CDF_Store.cxx, the method SetFolder().
0032785: Application Framework - CDF_Store::SetFolder incorrectly processes relative paths on Linux
The code is simplified - it checks the last character and if it is a folder separator, it removes it.
// Also, variable 'l' is renamed to 'aLen'.
// And a check on the number of characters is added to avoid removal of the root folder ('/').
Modified file:
- CDF_Store.cxx, the method SetFolder().
Standard_Boolean CDF_Store::SetFolder(const TCollection_ExtendedString& aFolder) {
TCollection_ExtendedString theFolder(aFolder);
- Standard_Integer l = theFolder.Length();
-
- // if the last character is the folder separator (which is always the first character)
- // it is removed.
- // This is correct for Unix systems but not for Windows! VMS and MAC? Thomas Haller, 23.11.01
- if(l > 1) {
-#ifndef _WIN32
- if(theFolder.Value(l) == theFolder.Value(1)) theFolder.Trunc(l-1);
-#else
- if (theFolder.Value(l) == '/' || theFolder.Value(l) == '\\')
- theFolder.Trunc(l-1);
-#endif
- }
+ Standard_Integer aLen = theFolder.Length();
+
+ // if the last character is the folder separator, remove it.
+ if (aLen > 1 && (theFolder.Value(aLen) == '/' || theFolder.Value(aLen) == '\\'))
+ theFolder.Trunc(aLen-1);
if(theMetaDataDriver->FindFolder(theFolder)) {
myCurrentDocument->SetRequestedFolder(theFolder);