>>>>> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes:

| Lars, this changes some of your code in message.C. Is it OK with you?

Lars> It might be....

Lars> I am not overly fond of the "inOSXbundle" stuff.

OK, let's see...

Lars> | char * old = strdup(setlocale(LC_ALL, 0)); | char * n =
Lars> setlocale(LC_ALL, lang_.c_str()); | + bindtextdomain(PACKAGE,
Lars> lyx_localedir().c_str()); | + textdomain(PACKAGE);

Lars> Why the move?

Because the localedir needs to be changes _after_ the Message object
has been created (which happens at startup). Maybe we could have a
Message::updateLocaleDir method or something to signal this kind of
thing, but it is not satisfactory either.

Lars> @@ -73,7 +75,10 @@ string const &
Lars> top_srcdir() | string const & lyx_localedir() | { | static
Lars> string const ll = "%LOCALEDIR%"; | - return ll; | + if
Lars> (localedir_.empty()) | + return ll; | + else | + return
Lars> localedir_;
Lars> |  }

Lars> Is the else needed?

It means: ``if we have an explicit localedir_, use it, else use the
static value''. I am not sure I understand the question.

Lars> | + // This is true when we are running from a Mac OS X bundle |
Lars> + // (for LyX/Mac) | + bool const inOSXBundle = | +
Lars> system_lyxdir_ == NormalizePath(AddPath(binpath,
Lars> "../Resources/") | + + OnlyFilename(binname)); | + if
Lars> (inOSXBundle) | + lyxerr[Debug::INIT] << "Running from LyX/Mac
Lars> bundle." | + << endl;

Lars> This should not be runtime... We know when we compile if we are
Lars> in OSX or not.

Not in this part of code, which is system-independent.

The problem is that this information is not available either at OS or
GUI level. LyX/Qt running under mac os x can be either a Qt/X11 app or
a Qt/Mac one. OK, it is actually possible at GUI level to know that we
are using Qt/Mac.

However, this bundle thing is a packaging issue, and this code would
work identically if we were using a native Gtk port to aqua (does that
exist?). So we would need yet another abstraction for packaging (that
could be useful under windows too). The inOSXbundle code does that,
but does not separate the code in its own framework yet. I think it is
good enough until we try to be serious about this packaging issue.

Lars>   os::setupEnvironment();

Maybe is it true for PATH setting on OS X, except that you don't do
that to an X11 program. This code is only useful because installing
fink apps does not update the PATH seen by native apps.

Lars> | + | + // | + // Determine locale directory | + // | + if
Lars> (!GetEnv("LYX_LOCALEDIR").empty()) { | + localedir_ =
Lars> GetEnv("LYX_LOCALEDIR"); | + lyxerr[Debug::INIT] <<
Lars> "LYX_LOCALEDIR=" << localedir_ << endl; | + } else if
Lars> (inOSXBundle) { | + string const maybe_localedir = | +
Lars> NormalizePath(AddPath(system_lyxdir_, "../locale")); | +
Lars> FileInfo fi(maybe_localedir); | + if (fi.isOK() && fi.isDir()) {
Lars> | + lyxerr[Debug::INIT] | + << "LyX/Mac: setting locale
Lars> directory to " | + << maybe_localedir << endl; | + localedir_ =
Lars> maybe_localedir;
Lars> | +               }

Lars>   } else { localedir_ = os::guessLocaleDir();
Lars>   }

Lars> Btw is the maybe really a maybe? (the maybe will be used always)

Not if the directory does not exist.

Lars> shouldn't this be fixed by LOCALEDIR in the first place, in the
Lars> configure system?

No, because you want the app bundle to be relocatable, it will not
always live in /Applications. Mac users are used to be able to move
around the application icon (which is actually a directory containing
the whole app) and have it still working.

Lars>   use_lyxdir_ = os::preferencesDir();

Except that it should rather be a packaging::preferenceDir().

JMarc

Reply via email to