>>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:
Angus> As promised, I'm posting the remainder of the changes that are Angus> needed to compile LyX with MinGW. This patch is much less Angus> intrusive than the original because the offensive os_win32.h is Angus> how #included only by those .C files that actually need it. +#ifdef _WIN32 +# include "support/os_win32.h" +#endif + I am not very fond of this thing. Could you at least in each of these instance add a comment telling what construct is missing? Then we could try to have a strategy on avoiding some of this stuff. The same holds for the other instances. +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif + <cunistd>? +#ifdef HAVE_SELECT retval = ::select(SELECT_TYPE_ARG1 (max(pipeout[0], pipeerr[0]) + 1), SELECT_TYPE_ARG234 (&infds), 0, 0, SELECT_TYPE_ARG5 (&tv)); +#else + retval = -1; +#endif Does it mean that ispell will not work in windows? @@ -289,7 +293,7 @@ void LyX::init(bool gui) do { // Path of binary/../share/name of binary/ searchpath += NormalizePath(AddPath(binpath, "../share/") + - OnlyFilename(binname)) + ';'; + ChangeExtension(OnlyFilename(binname),"")) + ';'; Don't we need something more selective, like removing ".exe" from the end of the string if it is here? Actually, I guess the whole LyX::init strategy should be rethought in the light of our platform support. A little digression: instead of our current os:: namespace, wouldn't it be better to have a hierarchy of os_foo classes with static methods, so that some environment could inherit others (like cygwin = unix + some stuff). The some of the code from this init method could be moved to os_foo.C files. @@ -113,6 +113,7 @@ string const fromqstr(QString const & st { QTextCodec * codec = QTextCodec::codecForLocale(); QCString tmpstr = codec->fromUnicode(str); - char const * tmpcstr = tmpstr; + char const * tmpcstr = "\0"; + if (!tmpstr.isEmpty()) tmpcstr = tmpstr; return tmpcstr; } Do you know what this does exactly? The indentation is wrong anyway. @@ -623,6 +623,8 @@ string const InsetGraphics::prepareFile( // without dots and again with ext temp_file = ChangeExtension( subst(temp_file, ".", "_"), ext_tmp); + //Remove drive letter on Win32 + if (temp_file[1] == ':') temp_file = temp_file.erase(0,2); // now we have any_dir_file.ext temp_file = MakeAbsPath(temp_file, buf->tmppath); lyxerr[Debug::GRAPHICS] I do not like this. Is there a reason why this should not be handled by some generic function? @@ -193,10 +196,12 @@ string const FileOpenSearch(string const notfound = false; } } -#ifdef __EMX__ +#if defined(__EMX__) || defined(_WIN32) if (ext.empty() && notfound) { real_file = FileOpenSearch(path, name, "exe"); - if (notfound) real_file = FileOpenSearch(path, name, "cmd"); +#ifdef __EMX__ + if (notfound) real_file = FileOpenSearch(path, name, "cmd"); +#endif If OS/2 looks for .cmd, should win32 look for .bat? The test should be on two lines. @@ -366,7 +371,7 @@ string const GetEnv(string const & envna string const GetEnvPath(string const & name) { -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(_WIN32) string const pathlist = subst(GetEnv(name), ':', ';'); #else string const pathlist = os::slashify_path(GetEnv(name)); First, there are a lot of lines like src/lyx_main.C:using lyx::support::GetEnvPath; that should be removed from the source Then, when you look at the remaining uses of GetEnvPath (in HEAD), you find two categories: - stuff in os_foo.C, which can have its own code without ifdef - stuff in path_defines.C.in, which does not consider list of paths anyway So I think we could maybe get rid of the function. Also we could decide to change os::slashify_path so that it does the :->; substitution as needed. JMarc