]> git.lyx.org Git - lyx.git/blobdiff - src/support/os_cygwin.cpp
Account for old versions of Pygments
[lyx.git] / src / support / os_cygwin.cpp
index c2bdb387a699bd0979511d314f68a05dc2f3e208..1de0da6ef195c50c58d6b2a7964c09ce9867b832 100644 (file)
@@ -210,10 +210,10 @@ BOOL terminate_handler(DWORD event)
 
 } // namespace anon
 
-void init(int argc, char * argv[])
+void init(int argc, char ** argv[])
 {
        argc_ = argc;
-       argv_ = argv;
+       argv_ = *argv;
 
        // Set environment's default locale
        setlocale(LC_ALL, "");
@@ -456,19 +456,14 @@ 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;
-       }
-
+       QString const win_path =
+               toqstr(convert_path(filename, PathStyle(windows)));
 
        // reference: http://msdn.microsoft.com/en-us/library/bb762153.aspx
-       char const * action = (mode == VIEW) ? "open" : "edit";
-       bool success = reinterpret_cast<long>(ShellExecute(NULL, action,
-                                       win_path.c_str(), NULL, NULL, 1)) > 32;
+       wchar_t const * action = (mode == VIEW) ? L"open" : L"edit";
+       bool success = reinterpret_cast<long>(ShellExecuteW(NULL, action,
+                       reinterpret_cast<wchar_t const *>(win_path.utf16()),
+                       NULL, NULL, 1)) > 32;
 
        if (!path.empty() && !lyxrc.texinputs_prefix.empty()) {
                setEnv("TEXINPUTS", oldtexinputs);