Abdelrazak Younes wrote:
On 04/10/2008 14:13, Peter Kümmel wrote:
Until we know a better way to get the long path name
I've checked in the patch:
http://www.lyx.org/trac/changeset/26718
(bug http://bugzilla.lyx.org/show_bug.cgi?id=4693)

Why did you you choose the 8bit encoding version? I'd prefer that you use the wide version of it because I am forecasting that this will not work for non latin file names, or just use the same macro as what's done in the Qt source.

Does this mean the lyx code is also wrong?
Or is the comment correct?
"// We can use to_local8bit, since file system encoding and the
// local 8 bit encoding are identical on windows."


static string const get_long_path(string const & short_path)
{
        // GetLongPathName needs the path in file system encoding.
        // We can use to_local8bit, since file system encoding and the
        // local 8 bit encoding are identical on windows.
        vector<char> long_path(MAX_PATH);
        DWORD result = 
GetLongPathName(to_local8bit(from_utf8(short_path)).c_str(),
                                       &long_path[0], long_path.size());

        if (result > long_path.size()) {
                long_path.resize(result);
                result = GetLongPathName(short_path.c_str(),
                                         &long_path[0], long_path.size());
                LASSERT(result <= long_path.size(), /**/);
        }

        return (result == 0) ? short_path : 
to_utf8(from_filesystem8bit(&long_path[0]));
}

Reply via email to