Enrico Forestieri <[EMAIL PROTECTED]> writes:
> Angus, can you try the attached patch? It works for me.
> In any case, moving around the whole LyX dir I can get localized menus.

I can certainly try but a couple of questions first:

why are we falling through to hardcoded_localedir(). I could have sworn that
there was code to find the locale dir relative to the directory holding the LyX
executable?

Using GetModuleFileName looks good, but thereafter I wonder if you shouldn't use
boost::filesystem? (http://www.boost.org/libs/filesystem/doc/path.htm)

Certainly, you shouldn't use strrchr et al. If the code below can't be made to
work, then there's a heap of useful functions to do what you're trying to
achieve in src/support/filetools.[Ch].

 string const hardcoded_localedir()
 {
+#ifdef _WIN32
        namespace fs = boost::filesystem;

        char buf[PATH_MAX];
        if (GetModuleFileName(NULL, buf, sizeof(buf)) > 0) {
                fs::path const modulePath(buf);
                if (!modulePath.has_relative_path()) {
                        fs::path const localePath =
                                modulePath.branch_path() / 
                                "Resources" / "locale"
                        return localePath.string());
        }

#endif
        return string("%LOCALEDIR%");
 }


Reply via email to