On 02/10/2010 11:33 AM, Daniel Russel wrote: >> True, particularly in Restrainer's case where you have paths embedded >> in your XML files - you can't use get_example_path() there. > Can't you use relative paths there? eg the .xml file contains > "./foo.dat" (or just "foo.dat") which should search for the data file > relative to the input xml. Otherwise, either you can't relocate you > setup or have to always run it from the same directory relative to the > .xml file, both of which would be very annoying. Or perhaps I'm confused.
I think you are confused - Elina is already using relative paths (e.g. 'input/foo.xml') but they don't work since the examples are run from the top-level directory - they need to be either 'modules/restrainer/examples/input/foo.xml' or 'build/doc/examples/restrainer/input/foo.xml' either of which would, if hard-coded in the XML, obviously preclude a user from running an installed example. Relative paths aren't relative to other files, of course, but relative to the current working directory (it is possible for Restrainer to have relative paths in the XML files be relative to the directory containing that XML though, I suppose).
> The directory containing the examples isn't necessarily writable (say > once they are installed), so we have to be careful about any files they > write. I think it is reasonable to insist that the working directory is > writeable to produce output, but we could also have the samples write to > a tmp dir.
You have to balance the confusion that will ensue if users can't find the example outputs against trying to write output into an unwriteable directory. Since the latter yields a pretty clear error message, it seems preferable to me.
Ben