Share 
Follow 
AboutDownloadsDocumentsForumsSource CodeIssuesNews
Date:
2013-07-29 02:04
Priority:
3
State:
Open
Submitted by:
Christopher Dembia (chrisdembia)
Assigned to:
Ayman Habib (aymanh)
Summary:
ExternalLoads path parsing bug

Detailed description
In AbstractTool.cpp (line 562) and in DynamicsTool.cpp (line 230); OpenSim 3.1, (most up to date OpenSim31 branch as of this bug report, 28 July 2013):

An issue exists when, in a setup file for ANY tool (ID, RRA, CMC), the external_loads file is NOT in the same directory as the setup file. For example, there is an issue when the value of external_loads_file is ../external_loads.xml.

The issue is that we are unable to find the external_loads.xml file, when it is indeed located in ../external_loads.xml.

Here is the reason:

The current working directory (cwd) is changed to the dir containing external_loads_file BEFORE ExternalLoads() is deserialized. Therefore, we can't even deserialized ExternalLoads() because we're now looking for it relative to external_loads_file, instead of relative to the initial setup file. In the example above, we chdir to '../', and then look for '../external_loads.xml', meaning the actual file has to be at '../../external_loads.xml'. Then, of course, the paths in the file will be parsed incorrectly.

Fixing this bug would be great, because it would allow a great reduction in file duplication when running multiple simulations/tools.

The fix should be simple: move the chDir() call to AFTER the ExternalLoads() try-catch block.

Add A Comment: Notepad

No Comments Have Been Posted

No Changes Have Been Made to This Item

Feedback