X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Fos_cygwin.cpp;h=c2bdb387a699bd0979511d314f68a05dc2f3e208;hb=522f3517e1d7f61ed2bbcafe0632f50cb3e8ae2f;hp=3464c04d785142fd4a4db3e10f686747addceef8;hpb=76dfde36d47189cf863eda7982888f6664630a57;p=lyx.git diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp index 3464c04d78..c2bdb387a6 100644 --- a/src/support/os_cygwin.cpp +++ b/src/support/os_cygwin.cpp @@ -456,8 +456,16 @@ bool autoOpenFile(string const & filename, auto_open_mode const mode, cygwin_internal(CW_SYNC_WINENV); } + string win_path; + try { + win_path = to_local8bit(from_utf8(convert_path(filename, PathStyle(windows)))); + } catch (...) { + LYXERR0("Cannot encode file name `" << filename << "' to local 8 bit encoding"); + return false; + } + + // reference: http://msdn.microsoft.com/en-us/library/bb762153.aspx - string const win_path = to_local8bit(from_utf8(convert_path(filename, PathStyle(windows)))); char const * action = (mode == VIEW) ? "open" : "edit"; bool success = reinterpret_cast(ShellExecute(NULL, action, win_path.c_str(), NULL, NULL, 1)) > 32;