View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005880ITKpublic2007-10-13 16:052007-11-26 10:51
ReporterS Pieper 
Assigned ToBill Lorensen 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005880: ITK_AUTOLOAD_PATH doesn't work when more than one separator
DescriptionIf I add the print statements in ObjectFactoryBase::LoadDynamicFactories()as shown in the Additional Information section below, and then I set ITK_AUTOLOAD_PATH to a string with more than one separator character I get the following:

path is /Users/pieper/slicer3/latest/Slicer3-build/bin:/tmp:/usr
CurrentPath is /Users/pieper/slicer3/latest/Slicer3-build/bin
CurrentPath is /tmp:/usr
CurrentPath is /usr
done loading

That is, the middle path is not correctly extracted.
Additional Information/**
 * Load all libraries in ITK_AUTOLOAD_PATH
 */
void
ObjectFactoryBase
::LoadDynamicFactories()
{
  /**
   * follow PATH conventions
   */
#ifdef _WIN32
  char PathSeparator = ';';
#else
  char PathSeparator = ':';
#endif
  
  std::string LoadPath;
  if (getenv("ITK_AUTOLOAD_PATH"))
    {
    LoadPath = getenv("ITK_AUTOLOAD_PATH");
    }
  else
    {
    return;
    }

  if(LoadPath.size() == 0)
    {
    return;
    }
  std::string::size_type EndSeparatorPosition = 0;
  std::string::size_type StartSeparatorPosition = 0;
std::cerr << "path is " << LoadPath << "\n";
  while ( StartSeparatorPosition != std::string::npos )
    {
    StartSeparatorPosition = EndSeparatorPosition;
    /**
     * find PathSeparator in LoadPath
     */
    EndSeparatorPosition = LoadPath.find(PathSeparator,
                                         StartSeparatorPosition);
    if(EndSeparatorPosition == std::string::npos)
      {
      EndSeparatorPosition = LoadPath.size();
      }
    std::string CurrentPath =
      LoadPath.substr(StartSeparatorPosition, EndSeparatorPosition);
std::cerr << "CurrentPath is " << CurrentPath << "\n";
    ObjectFactoryBase::LoadLibrariesInPath(CurrentPath.c_str());
    /**
     * move past separator
     */
    if(EndSeparatorPosition == LoadPath.size())
      {
      StartSeparatorPosition = std::string::npos;
      }
    else
      {
      EndSeparatorPosition++;
      }
    }
std::cerr << "done loading\n";
}
TagsNo tags attached.
Resolution Date
Sprint
Sprint Status
Attached Files

 Relationships

  Notes
(0009629)
Bill Lorensen (developer)
2007-11-04 20:36

I added the print statements suggested by Steve and reproduced the problem.
(0009630)
Bill Lorensen (developer)
2007-11-04 20:39

The logic in the path parsing was flawed. The std::string substr method was being used incorrectly. The second argument is the length of the substring, not the position of the end of the substring.

 Issue History
Date Modified Username Field Change
2007-10-13 16:05 S Pieper New Issue
2007-10-27 12:15 Bill Lorensen Status new => assigned
2007-10-27 12:15 Bill Lorensen Assigned To => Bill Lorensen
2007-11-04 20:36 Bill Lorensen Note Added: 0009629
2007-11-04 20:36 Bill Lorensen Status assigned => confirmed
2007-11-04 20:39 Bill Lorensen Status confirmed => resolved
2007-11-04 20:39 Bill Lorensen Resolution open => fixed
2007-11-04 20:39 Bill Lorensen Note Added: 0009630
2007-11-26 10:51 Bill Lorensen Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team