Jean-Marc Lasgouttes wrote:
> Angus> Jean-Marc, are you happy for me to commit this patch?
> 
> I would probably have moved max_length and its comment inside
> mangled_filename, but the patch is fine.

Hmmmm. But what would the interface to mangled_filename be? (I ask because
we need something similar for LyX 1.4.x, so we may as well get this right
now.)

The allowable length of "mangled_file_name" below is dependent on the
(unmangled) path to the directory that is to contain this file:

    C:/Documents and Settings/Angus/Local
Settings/Temp/lyx_tmpdirXXXXX/lyx_tmpbuf0/mangled_file_name

I guess that we could have:

/** @param filename the file path that is to be mangled.
 *  @param dir the directory that will contain this file with
 *  its mangled name. This information is used by the mangling
 *  algorithm when determining the maximum allowable length of
 *  the mangled name.
 *  @returns a mangled representation of the input @c filename.
 *  Eg C:/foo bar/baz.eps -> 0C__foo_bar_baz.eps
 *  The integer prefix is used to guarantee that the file name
 *  is unique.
 *  Only the file name is returned. It is not prepended with @c dir.
 */
string const mangled_filename(string const & filename,
                              string const & dir = string()); 

-- 
Angus

Reply via email to