I finally found the time to put together the promised patch. I had to rename "cygwin_path_fix" as "windows_style_tex_paths" instead of "posix_style_tex_paths" for compatibility reasons. Indeed, the meaning of cygwin_path_fix was "the TeX engine expects windows paths".
Please, find attached the patch. Let me know if you want a similar patch for 1.4.x. It would be slightly different as the support for tetex in native WIN32 has not been backported, still. I tested the patch on native WIN32 and cygwin and it works. The old "\cygwin_path_fix_needed" switch is still accepted on reading but is replaced by the new "\tex_expects_windows_paths" on writing. -- Enrico
Log: Renaming: cygwin_path_fix -> windows_style_tex_paths cygwin_path_fix_needed -> tex_expects_windows_paths check_cygwin_path -> check_windows_style_tex_paths use_cygwin_paths -> use_windows_paths RC_CYGWIN_PATH_FIX -> RC_TEX_EXPECTS_WINDOWS_PATHS * src/frontends/qt4/ui/QPrefCygwinPathUi.ui * src/frontends/qt3/ui/QPrefCygwinPathModule.ui Updated checkbutton label and description * src/frontends/qt4/QPrefsDialog.C (PrefCygwinPath): cygwin_path_fix -> windows_style_tex_paths (QPrefsDialog): Enable checkbutton for native WIN32 builds * src/frontends/xforms/forms/form_preferences.fd Updated label and name of checkbutton * src/frontends/xforms/FormPreferences.C (apply): cygwin_path_fix -> windows_style_tex_paths check_cygwin_path -> check_windows_style_tex_paths (build): Enable checkbutton for native WIN32 builds (update): Ditto (feedback): Updated description * src/frontends/qt3/QPrefs.C * src/frontends/qt3/QPrefsDialog.C * src/frontends/qt3/QPrefsDialog.h Renaming as above, enabled checkbutton for native WIN32 builds * src/support/os_unix.C * src/support/os.h * src/support/os_win32.C Renaming cygwin_path_fix -> windows_style_tex_paths * src/support/os_cygwin.C Ditto (external_path, external_path_list): always return windows style paths, not depending on the checkbutton status * src/lyxrc.C * src/lyxrc.h * src/lyxfunc.C * src/lyx_main.C Renaming, compatibility with previous switch * lib/configure.py Renaming, more meaningful diagnostics
Index: src/lyxfunc.C =================================================================== --- src/lyxfunc.C (revision 14209) +++ src/lyxfunc.C (working copy) @@ -1991,11 +1991,6 @@ case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR: case LyXRC::RC_CUSTOM_EXPORT_COMMAND: case LyXRC::RC_CUSTOM_EXPORT_FORMAT: - case LyXRC::RC_CYGWIN_PATH_FIX: - if (lyxrc_orig.cygwin_path_fix != lyxrc_new.cygwin_path_fix) { - namespace os = lyx::support::os; - os::cygwin_path_fix(lyxrc_new.cygwin_path_fix); - } case LyXRC::RC_DATE_INSERT_FORMAT: case LyXRC::RC_DEFAULT_LANGUAGE: case LyXRC::RC_DEFAULT_PAPERSIZE: @@ -2081,6 +2076,11 @@ case LyXRC::RC_TEMPDIRPATH: case LyXRC::RC_TEMPLATEPATH: case LyXRC::RC_TEX_ALLOWS_SPACES: + case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS: + if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) { + namespace os = lyx::support::os; + os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths); + } case LyXRC::RC_UIFILE: case LyXRC::RC_USER_EMAIL: case LyXRC::RC_USER_NAME: Index: src/frontends/qt3/QPrefs.C =================================================================== --- src/frontends/qt3/QPrefs.C (revision 14209) +++ src/frontends/qt3/QPrefs.C (working copy) @@ -23,7 +23,7 @@ #include "ui/QPrefLatexModule.h" #include "ui/QPrefScreenFontsModule.h" #include "ui/QPrefColorsModule.h" -#if defined(__CYGWIN__) || defined(__CYGWIN32__) +#if defined(__CYGWIN__) || defined(_WIN32) #include "ui/QPrefCygwinPathModule.h" #endif #include "ui/QPrefDisplayModule.h" @@ -204,9 +204,9 @@ rc.date_insert_format = fromqstr(datemod->DateED->text()); -#if defined(__CYGWIN__) || defined(__CYGWIN32__) +#if defined(__CYGWIN__) || defined(_WIN32) QPrefCygwinPathModule * cygwinmod(dialog_->cygwinpathModule); - rc.cygwin_path_fix = !cygwinmod->pathCB->isChecked(); + rc.windows_style_tex_paths = cygwinmod->pathCB->isChecked(); #endif QPrefLatexModule * latexmod(dialog_->latexModule); @@ -548,9 +548,9 @@ datemod->DateED->setText(toqstr(rc.date_insert_format)); -#if defined(__CYGWIN__) || defined(__CYGWIN32__) +#if defined(__CYGWIN__) || defined(_WIN32) QPrefCygwinPathModule * cygwinmod(dialog_->cygwinpathModule); - cygwinmod->pathCB->setChecked(!rc.cygwin_path_fix); + cygwinmod->pathCB->setChecked(rc.windows_style_tex_paths); #endif QPrefLatexModule * latexmod(dialog_->latexModule); Index: src/frontends/qt3/QPrefsDialog.C =================================================================== --- src/frontends/qt3/QPrefsDialog.C (revision 14209) +++ src/frontends/qt3/QPrefsDialog.C (working copy) @@ -27,7 +27,7 @@ #include "ui/QPrefLatexModule.h" #include "ui/QPrefScreenFontsModule.h" #include "ui/QPrefColorsModule.h" -#if defined(__CYGWIN__) || defined(__CYGWIN32__) +#if defined(__CYGWIN__) || defined(_WIN32) #include "ui/QPrefCygwinPathModule.h" #endif #include "ui/QPrefDisplayModule.h" @@ -79,7 +79,7 @@ latexModule = new QPrefLatexModule(this); screenfontsModule = new QPrefScreenFontsModule(this); colorsModule = new QPrefColorsModule(this); -#if defined(__CYGWIN__) || defined(__CYGWIN32__) +#if defined(__CYGWIN__) || defined(_WIN32) cygwinpathModule = new QPrefCygwinPathModule(this); #endif displayModule = new QPrefDisplayModule(this); @@ -111,7 +111,7 @@ prefsPS->addPanel(asciiModule, _("Plain text"), op); prefsPS->addPanel(dateModule, _("Date format"), op); prefsPS->addPanel(latexModule, _("LaTeX"), op); -#if defined(__CYGWIN__) || defined(__CYGWIN32__) +#if defined(__CYGWIN__) || defined(_WIN32) prefsPS->addPanel(cygwinpathModule, _("Paths"), op); #endif prefsPS->addPanel(printerModule, _("Printer"), op); @@ -243,7 +243,7 @@ connect(asciiModule->asciiLinelengthSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor())); connect(asciiModule->asciiRoffED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); connect(dateModule->DateED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); -#if defined(__CYGWIN__) || defined(__CYGWIN32__) +#if defined(__CYGWIN__) || defined(_WIN32) connect(cygwinpathModule->pathCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); #endif connect(latexModule->latexEncodingED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); Index: src/frontends/qt3/ui/QPrefCygwinPathModule.ui =================================================================== --- src/frontends/qt3/ui/QPrefCygwinPathModule.ui (revision 14209) +++ src/frontends/qt3/ui/QPrefCygwinPathModule.ui (working copy) @@ -31,13 +31,13 @@ </rect> </property> <property name="text"> - <string>&Use Cygwin-style paths</string> + <string>&Use Windows-style paths in LaTeX files</string> </property> <property name="toolTip" stdset="0"> <string></string> </property> <property name="whatsThis" stdset="0"> - <string>Select if LyX should output Cygwin-style paths rather than Windows-style paths. Useful if you're using the Cygwin teTeX rather than a native Windows MikTeX. Note, however, that you'll need to write shell script wrappers for all your converters.</string> + <string>Select if LyX should output Windows-style paths rather than Posix-style paths to LaTeX files. Useful if you're using the native Windows MikTeX rather than the Cygwin teTeX.</string> </property> </widget> <spacer> Index: src/frontends/qt3/QPrefsDialog.h =================================================================== --- src/frontends/qt3/QPrefsDialog.h (revision 14209) +++ src/frontends/qt3/QPrefsDialog.h (working copy) @@ -110,7 +110,7 @@ QPrefLatexModule * latexModule; QPrefScreenFontsModule * screenfontsModule; QPrefColorsModule * colorsModule; -#if defined(__CYGWIN__) || defined(__CYGWIN32__) +#if defined(__CYGWIN__) || defined(_WIN32) QPrefCygwinPathModule * cygwinpathModule; #endif QPrefDisplayModule * displayModule; Index: src/frontends/qt4/QPrefsDialog.C =================================================================== --- src/frontends/qt4/QPrefsDialog.C (revision 14209) +++ src/frontends/qt4/QPrefsDialog.C (working copy) @@ -576,13 +576,13 @@ void PrefCygwinPath::apply(LyXRC & rc) const { - rc.cygwin_path_fix = pathCB->isChecked(); + rc.windows_style_tex_paths = pathCB->isChecked(); } void PrefCygwinPath::update(LyXRC const & rc) { - pathCB->setChecked(rc.cygwin_path_fix); + pathCB->setChecked(rc.windows_style_tex_paths); } @@ -1801,7 +1801,7 @@ add(new PrefScreenFonts(form_)); add(new PrefColors(form_)); -#if defined(__CYGWIN__) || defined(__CYGWIN32__) +#if defined(__CYGWIN__) || defined(_WIN32) add(new PrefCygwinPath); #endif Index: src/frontends/qt4/ui/QPrefCygwinPathUi.ui =================================================================== --- src/frontends/qt4/ui/QPrefCygwinPathUi.ui (revision 14209) +++ src/frontends/qt4/ui/QPrefCygwinPathUi.ui (working copy) @@ -31,10 +31,10 @@ <string/> </property> <property name="whatsThis" > - <string>Select if LyX should output Cygwin-style paths rather than Windows-style paths. Useful if you're using the Cygwin teTeX rather than a native Windows MikTeX. Note, however, that you'll need to write shell script wrappers for all your converters.</string> + <string>Select if LyX should output Windows-style paths rather than Posix-style paths to LaTeX files. Useful if you're using the native Windows MikTeX rather than the Cygwin teTeX.</string> </property> <property name="text" > - <string>&Use Cygwin-style paths</string> + <string>&Use Windows-style paths in LaTeX files</string> </property> </widget> </widget> Index: src/frontends/xforms/FormPreferences.C =================================================================== --- src/frontends/xforms/FormPreferences.C (revision 14209) +++ src/frontends/xforms/FormPreferences.C (working copy) @@ -2085,8 +2085,9 @@ rc.view_dvi_paper_option = getString(dialog_->input_paperoption); rc.auto_reset_options = fl_get_button(dialog_->check_autoreset_classopt); -#if defined(__CYGWIN__) || defined(__CYGWIN32__) - rc.cygwin_path_fix = fl_get_button(dialog_->check_cygwin_path); +#if defined(__CYGWIN__) || defined(_WIN32) + rc.windows_style_tex_paths = + fl_get_button(dialog_->check_windows_style_tex_paths); #endif } @@ -2105,9 +2106,9 @@ fl_set_input_return(dialog_->input_index, FL_RETURN_CHANGED); fl_set_input_return(dialog_->input_paperoption, FL_RETURN_CHANGED); -#if defined(__CYGWIN__) || defined(__CYGWIN32__) +#if defined(__CYGWIN__) || defined(_WIN32) #else - setEnabled(dialog_->check_cygwin_path, false); + setEnabled(dialog_->check_windows_style_tex_paths, false); #endif fl_addto_choice(dialog_->choice_default_papersize, @@ -2124,8 +2125,8 @@ setPrehandler(dialog_->input_index); setPrehandler(dialog_->input_paperoption); setPrehandler(dialog_->check_autoreset_classopt); -#if defined(__CYGWIN__) || defined(__CYGWIN32__) - setPrehandler(dialog_->check_cygwin_path); +#if defined(__CYGWIN__) || defined(_WIN32) + setPrehandler(dialog_->check_windows_style_tex_paths); #endif } @@ -2151,13 +2152,12 @@ return LyXRC::getDescription(LyXRC::RC_VIEWDVI_PAPEROPTION); if (ob == dialog_->check_autoreset_classopt) return LyXRC::getDescription(LyXRC::RC_AUTORESET_OPTIONS); -#if defined(__CYGWIN__) || defined(__CYGWIN32__) - if (ob == dialog_->check_cygwin_path) - return _("Select if LyX should output Cygwin-style paths " - "rather than Windows-style paths. Useful if you're " - "using the Cygwin teTeX rather than a native Windows " - "MikTeX. Note, however, that you'll need to write " - "shell script wrappers for all your converters."); +#if defined(__CYGWIN__) || defined(_WIN32) + if (ob == dialog_->check_windows_style_tex_paths) + return _("Select if LyX should output Windows-style paths " + "rather than Posix-style paths to LaTeX files. " + "Useful if you're using the native Windows MikTeX " + "rather than the Cygwin teTeX."); #endif return string(); } @@ -2183,8 +2183,9 @@ rc.view_dvi_paper_option.c_str()); fl_set_button(dialog_->check_autoreset_classopt, rc.auto_reset_options); -#if defined(__CYGWIN__) || defined(__CYGWIN32__) - fl_set_button(dialog_->check_cygwin_path, rc.cygwin_path_fix); +#if defined(__CYGWIN__) || defined(_WIN32) + fl_set_button(dialog_->check_windows_style_tex_paths, + rc.windows_style_tex_paths); #endif } Index: src/frontends/xforms/forms/form_preferences.fd =================================================================== --- src/frontends/xforms/forms/form_preferences.fd (revision 14209) +++ src/frontends/xforms/forms/form_preferences.fd (working copy) @@ -3149,11 +3149,11 @@ style: FL_NORMAL_STYLE size: FL_NORMAL_SIZE lcol: FL_BLACK -label: Use Cygwin Paths|#s +label: Use Windows Paths for LaTeX|#s shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity -name: check_cygwin_path +name: check_windows_style_tex_paths callback: C_FormDialogView_InputCB argument: 0 Index: src/support/os_unix.C =================================================================== --- src/support/os_unix.C (revision 14209) +++ src/support/os_unix.C (working copy) @@ -116,7 +116,7 @@ } -void cygwin_path_fix(bool) +void windows_style_tex_paths(bool) {} bool canAutoOpenFile(string const & ext, auto_open_mode const mode) Index: src/support/os.h =================================================================== --- src/support/os.h (revision 14209) +++ src/support/os.h (working copy) @@ -74,11 +74,11 @@ */ char path_separator(); -/** If @c use_cygwin_paths is true, LyX will output cygwin style paths - * rather than native Win32 ones. Obviously, this option is used only - * under Cygwin. +/** If @c use_windows_paths is true, LyX will output Windows-style paths to + * latex files rather than posix ones. Obviously, this option is used only + * under Windows. */ -void cygwin_path_fix(bool use_cygwin_paths); +void windows_style_tex_paths(bool use_windows_paths); enum auto_open_mode { VIEW, Index: src/support/os_win32.C =================================================================== --- src/support/os_win32.C (revision 14209) +++ src/support/os_win32.C (working copy) @@ -76,7 +76,7 @@ namespace { -bool cygwin_path_fix_ = false; +bool windows_style_tex_paths_ = true; string cygdrive = "/cygdrive"; @@ -260,15 +260,15 @@ string latex_path(string const & p) { // We may need a posix style path or a windows style path (depending - // on cygwin_path_fix_), but we use always forward slashes, since it - // gets written into a .tex file. + // on windows_style_tex_paths_), but we use always forward slashes, + // since it gets written into a .tex file. - if (cygwin_path_fix_ && is_absolute_path(p)) { + if (!windows_style_tex_paths_ && is_absolute_path(p)) { string const drive = p.substr(0, 2); string const cygprefix = cygdrive + "/" + drive.substr(0, 1); string const cygpath = subst(subst(p, '\\', '/'), drive, cygprefix); lyxerr[Debug::LATEX] - << "<Cygwin path correction> [" + << "<Path correction for LaTeX> [" << p << "]->>[" << cygpath << ']' << endl; return cygpath; @@ -322,9 +322,9 @@ } -void cygwin_path_fix(bool use_cygwin_paths) +void windows_style_tex_paths(bool use_windows_paths) { - cygwin_path_fix_ = !use_cygwin_paths; + windows_style_tex_paths_ = use_windows_paths; } Index: src/support/os_cygwin.C =================================================================== --- src/support/os_cygwin.C (revision 14209) +++ src/support/os_cygwin.C (working copy) @@ -39,7 +39,7 @@ namespace { -bool cygwin_path_fix_ = false; +bool windows_style_tex_paths_ = false; // In both is_posix_path() and is_windows_path() it is assumed that // a valid posix or pseudo-windows path is passed. They simply tell @@ -186,8 +186,7 @@ string external_path(string const & p) { - return convert_path(p, cygwin_path_fix_ ? PathStyle(windows) - : PathStyle(posix)); + return convert_path(p, PathStyle(windows)); } @@ -199,8 +198,7 @@ string external_path_list(string const & p) { - return convert_path_list(p, cygwin_path_fix_ ? PathStyle(windows) - : PathStyle(posix)); + return convert_path_list(p, PathStyle(windows)); } @@ -213,13 +211,13 @@ string latex_path(string const & p) { // We may need a posix style path or a windows style path (depending - // on cygwin_path_fix_), but we use always forward slashes, since it - // gets written into a .tex file. + // on windows_style_tex_paths_), but we use always forward slashes, + // since it gets written into a .tex file. - if (cygwin_path_fix_ && is_absolute_path(p)) { + if (windows_style_tex_paths_ && is_absolute_path(p)) { string dos_path = convert_path(p, PathStyle(windows)); lyxerr[Debug::LATEX] - << "<Cygwin path correction> [" + << "<Path correction for LaTeX> [" << p << "]->>[" << dos_path << ']' << endl; return dos_path; @@ -268,9 +266,9 @@ } -void cygwin_path_fix(bool use_cygwin_paths) +void windows_style_tex_paths(bool use_windows_paths) { - cygwin_path_fix_ = use_cygwin_paths; + windows_style_tex_paths_ = use_windows_paths; } @@ -295,8 +293,7 @@ { // reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc // /platform/shell/reference/functions/shellexecute.asp - string const win_path = - os::convert_path(filename, os::PathStyle(os::windows)); + string const win_path = convert_path(filename, PathStyle(windows)); char const * action = (mode == VIEW) ? "open" : "edit"; return reinterpret_cast<int>(ShellExecute(NULL, action, win_path.c_str(), NULL, NULL, 1)) > 32; Index: src/lyxrc.C =================================================================== --- src/lyxrc.C (revision 14209) +++ src/lyxrc.C (working copy) @@ -81,7 +81,8 @@ { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR }, { "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND }, { "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT }, - { "\\cygwin_path_fix_needed", LyXRC::RC_CYGWIN_PATH_FIX }, + // compatibility with versions older than 1.4.2 only + { "\\cygwin_path_fix_needed", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS }, { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT }, { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE }, { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE }, @@ -163,6 +164,7 @@ { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH }, { "\\template_path", LyXRC::RC_TEMPLATEPATH }, { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES }, + { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS }, { "\\ui_file", LyXRC::RC_UIFILE }, { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG }, { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS }, @@ -280,7 +282,7 @@ language_command_local = "\\foreignlanguage{$$lang}{"; default_language = "english"; show_banner = true; - cygwin_path_fix = false; + windows_style_tex_paths = false; tex_allows_spaces = false; date_insert_format = "%A, %e %B %Y"; cursor_follows_scrollbar = false; @@ -398,9 +400,9 @@ } break; - case RC_CYGWIN_PATH_FIX: + case RC_TEX_EXPECTS_WINDOWS_PATHS: if (lexrc.next()) { - cygwin_path_fix = lexrc.getBool(); + windows_style_tex_paths = lexrc.getBool(); } break; @@ -1374,11 +1376,11 @@ index_command != system_lyxrc.index_command) { os << "\\index_command \"" << index_command << "\"\n"; } - case RC_CYGWIN_PATH_FIX: + case RC_TEX_EXPECTS_WINDOWS_PATHS: if (ignore_system_lyxrc || - cygwin_path_fix != system_lyxrc.cygwin_path_fix) { - os << "\\cygwin_path_fix_needed " - << convert<string>(cygwin_path_fix) << '\n'; + windows_style_tex_paths != system_lyxrc.windows_style_tex_paths) { + os << "\\tex_expects_windows_paths " + << convert<string>(windows_style_tex_paths) << '\n'; } case RC_TEX_ALLOWS_SPACES: if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) { @@ -2203,9 +2205,6 @@ case RC_CUSTOM_EXPORT_FORMAT: break; - case RC_CYGWIN_PATH_FIX: - break; - case RC_DATE_INSERT_FORMAT: //xgettext:no-c-format str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\"."); @@ -2490,6 +2489,9 @@ case RC_TEX_ALLOWS_SPACES: break; + case RC_TEX_EXPECTS_WINDOWS_PATHS: + break; + case RC_UIFILE: str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories."); break; Index: src/lyxrc.h =================================================================== --- src/lyxrc.h (revision 14209) +++ src/lyxrc.h (working copy) @@ -51,7 +51,6 @@ RC_CURSOR_FOLLOWS_SCROLLBAR, RC_CUSTOM_EXPORT_COMMAND, RC_CUSTOM_EXPORT_FORMAT, - RC_CYGWIN_PATH_FIX, RC_DATE_INSERT_FORMAT, RC_DEFAULT_LANGUAGE, RC_DEFAULT_PAPERSIZE, @@ -128,6 +127,7 @@ RC_TEMPDIRPATH, RC_TEMPLATEPATH, RC_TEX_ALLOWS_SPACES, + RC_TEX_EXPECTS_WINDOWS_PATHS, RC_UIFILE, RC_USER_EMAIL, RC_USER_NAME, @@ -389,8 +389,8 @@ std::string user_name; /// user email std::string user_email; - /// - bool cygwin_path_fix; + /// True if the TeX engine cannot handle posix paths + bool windows_style_tex_paths; /// True if the TeX engine can handle file names containing spaces bool tex_allows_spaces; /** Prepend paths to the PATH environment variable. Index: src/lyx_main.C =================================================================== --- src/lyx_main.C (revision 14209) +++ src/lyx_main.C (working copy) @@ -545,7 +545,7 @@ if (lyxerr.debugging(Debug::LYXRC)) lyxrc.print(); - os::cygwin_path_fix(lyxrc.cygwin_path_fix); + os::windows_style_tex_paths(lyxrc.windows_style_tex_paths); if (!lyxrc.path_prefix.empty()) prependEnvPath("PATH", lyxrc.path_prefix); Index: lib/configure.py =================================================================== --- lib/configure.py (revision 14209) +++ lib/configure.py (working copy) @@ -78,38 +78,38 @@ sys.exit(1) -def checkCygwinPath(srcdir): - ''' Adjust PATH for Win32 (Cygwin) ''' - cygwin_path_fix = '' - if os.name == 'nt': - cygwin_path_fix = 'true' - elif sys.platform == 'cygwin': +def checkTeXPaths(): + ''' Determine the path-style needed by the TeX engine on Win32 (Cygwin) ''' + windows_style_tex_paths = '' + if os.name == 'nt' or sys.platform == 'cygwin': from tempfile import mkstemp - fd, tmpfname = mkstemp(suffix='.ltx', dir='/tmp') + fd, tmpfname = mkstemp(suffix='.ltx') + # a wrapper file + wfd, wtmpfname = mkstemp(suffix='.ltx') + if os.name == 'nt': + inpname = tmpfname.replace('\\', '/') + wtmpfname = wtmpfname.replace('\\', '/') + else: + inpname = cmdOutput('cygpath -m ' + tmpfname) + wtmpfname = cmdOutput('cygpath -m ' + wtmpfname) os.write(fd, r''' \documentstyle{article} \begin{document}\end{document} ''') os.close(fd) - inpname = cmdOutput('cygpath -m ' + tmpfname) - # a wrapper file - wfd, wtmpfname = mkstemp(suffix='.ltx', dir='/tmp') - wtmpfname = cmdOutput('cygpath -m ' + wtmpfname) - os.write(wfd, r'\input{' + inpname + '}' ) + os.write(wfd, r'\input{' + inpname.replace('~', '\\string~') + '}' ) os.close(wfd) if cmdOutput('latex ' + wtmpfname).find('Error') != -1: - print "configure: cygwin detected; path correction is not needed" - cygwin_path_fix = 'false' + print "configure: TeX engine needs posix-style paths in latex files" + windows_style_tex_paths = 'false' else: - print "configure: cygwin detected; path correction" - srcdir = cmdOutput('cygpath -m ' + srcdir) - print "srcdir = ", srcdir - cygwin_path_fix = 'true' + print "configure: TeX engine needs windows-style paths in latex files" + windows_style_tex_paths = 'true' tmpbname,ext = os.path.splitext(os.path.basename(tmpfname)) wtmpbname,ext = os.path.splitext(os.path.basename(wtmpfname)) removeFiles( [ tmpfname, wtmpfname, tmpbname + '.log', \ tmpbname + '.aux', wtmpbname + '.log', wtmpbname + '.aux' ] ) - return cygwin_path_fix + return windows_style_tex_paths ## Searching some useful programs @@ -700,7 +700,7 @@ sys.exit(1) setEnviron() createDirectories() - cygwin_path_fix = checkCygwinPath(srcdir) + windows_style_tex_paths = checkTeXPaths() ## Write the first part of outfile writeToFile(outfile, '''# This file has been automatically generated by LyX' lib/configure.py # script. It contains default settings that have been determined by @@ -716,9 +716,9 @@ (chk_linuxdoc, bool_linuxdoc, linuxdoc_cmd) = checkLinuxDoc() (chk_docbook, bool_docbook, docbook_cmd) = checkDocBook() checkTeXAllowSpaces() + if windows_style_tex_paths != '': + addToRC(r'\tex_expects_windows_paths %s' % windows_style_tex_paths) checkOtherEntries() - if cygwin_path_fix != '': - addToRC(r'\cygwin_path_fix_needed %s' % cygwin_path_fix) # --without-latex-config can disable lyx_check_config checkLatexConfig( lyx_check_config and LATEX != '', bool_docbook, bool_linuxdoc) createLaTeXConfig()