I remember having a rant sometime ago about the need for something better than our current handling of file names. My proposal was to have a helper class that would enable us to 'do the right thing' when reading/writing the buffer to file:
class FileName { public: FileName(); /** \param abs_filename the name of the path with full path. \param save_abs_path should the file name be stored in the LyX file as an absolute path or relative to the buffer? */ FileName(string const & abs_filename, bool save_abs_path = true); bool empty() const { return name_.empty(); } string const absFilename() const { return name_; } void absFilename(string const abs_filename); bool saveAbsPath() const { return save_abs_path_; } void saveAbsPath(bool); private: string name_; bool save_abs_path_; }; Internally we use FileName::absFilename() but we check FileName::saveAbsPath() when reading/writing to file. The attached patch implements this and uses it for the graphics inset. (Also removes a couple of #warnings as the code is fixed properly.) Do people think this is a clean solution? Should I move the class into its own files rather than putting it in support/filetools.[Ch]? Comments please. -- Angus