There are several places where file paths are stored in SMTK core:
- File and Directory Items in Attribute Resources
- Resource Information stored in Links
- Location of native model files for Model Resources
With the ongoing development work on supporting the concept of Projects (and the requirement that Projects should be relocatable), the question of how to properly deal with file paths and when to store the information using absolute vs relative paths needs to be addressed.
Let the I/O Handle It
Its seems that when loaded in core, the simplest thing to do for Resources is to have the locations for Resources that are in-core to be in absolute format since I’m not sure what the benefits are in supporting relative paths for in-core resources and (In fact I can think of one major problem if the path was relative which is how to save the Resource with a relative path without having the directory path needed to write it.
We could simply let the I/O operations do the conversion since they could be given a directory path (for example the path of a Project), to use in determining if the Resource path should be relative or not. So the location of Resources could be saved in relative format but when read into the system the location information would be converted into absolute.
If FileSystem Items needed to be store using relative paths, this could be tricky. I can see how I can do this in the XML format since there is a single class doing the work. I’m not sure how the JSON code could do this since there doesn’t seem to be an easy way to do this.
Comments?