Rob Bearman wrote:
>> You mentioned earlier that you couldn't run LyX from the console? I
>> wonder why not. Here Start->Run "command", followed by
>> <path to lyx>/lyx -dbg graphics,file > lyx.log
>> works perfectly.
>
> What I meant to say is that I can't get debug output displayed to the
> console, or anywhere else for that matter. I usually start LyX from a
> cmd.exe console. Your command specification doesn't work for me at all,
> not that it particularly matters, except that I was hoping perhaps this
> was a secret way to get debug output to a log file. I'm curious why you
> run "command" rather than "cmd." Are you running on a Win9x box? I'm
> running XP.
Me too.
> BTW, see http://www.hyperorg.com/blogger/mtarchive/001935.html for
> comments on the difference between command.exe and cmd.exe, if you're
> interested.
I'm just displaying my ignorance of all things Windows :) Thanks for the
info. I'm rather surprised that you don't get any output though.
One thing that you could do is get LyX to direct these log messages to a
file. Eg, in main.C, change this:
// To avoid ordering of global object problems with some
// stdlibs we do the initialization here, but still as
// early as possible.
lyxerr.rdbuf(std::cerr.rdbuf());
to something like
ofstream logger("C:/foo/bar/lyx.log");
if (logger)
lyxerr.rdbuf(logger.rdbuf());
else
lyxerr.rdbuf(std::cerr.rdbuf());
> All his as a prelude to stating I've never been able to run "lyx" from
> the command line; only "lyx.exe". I finally looked into this and see
> that get_binary_path() in package.C doesn't handle the case where
> argv[0] provides the executable name minus the .exe extension. Note that
> when you run from the Start->Run dialog, Windows apparently appends the
> ".exe" string if the user has neglected it. Not so, of course, from the
> command line. This should probably be addressed since it's not uncommon
> to launch from cmd windows without specifying the executable extension
> (whether it be .exe, .bat, or .cmd).
Ok, then could you try the attached patch please.
--
Angus
Index: src/support/package.C.in
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/package.C.in,v
retrieving revision 1.10
diff -u -p -r1.10 package.C.in
--- src/support/package.C.in 19 Apr 2005 12:29:21 -0000 1.10
+++ src/support/package.C.in 22 Apr 2005 17:28:16 -0000
@@ -414,7 +414,16 @@ string const abs_path_from_command_line(
// Does the grunt work for abs_path_from_binary_name()
string const get_binary_path(string const & exe)
{
+#if defined (USE_WINDOWS_PACKAGING)
+ // The executable may have been invoked either with or
+ // without the .exe extension.
+ // Ensure that it is present.
+ string const as_internal_path = os::internal_path(exe);
+ string const exe_path = suffixIs(as_internal_path, ".exe") ?
+ as_internal_path : as_internal_path + ".exe";
+#else
string const exe_path = os::internal_path(exe);
+#endif
if (os::is_absolute_path(exe_path))
return exe_path;