mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
On windows, use the unicode version of ShellExecute
This commit is contained in:
parent
f7768c994d
commit
d996ec8992
@ -456,19 +456,14 @@ bool autoOpenFile(string const & filename, auto_open_mode const mode,
|
|||||||
cygwin_internal(CW_SYNC_WINENV);
|
cygwin_internal(CW_SYNC_WINENV);
|
||||||
}
|
}
|
||||||
|
|
||||||
string win_path;
|
QString const win_path =
|
||||||
try {
|
toqstr(convert_path(filename, PathStyle(windows)));
|
||||||
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
|
// reference: http://msdn.microsoft.com/en-us/library/bb762153.aspx
|
||||||
char const * action = (mode == VIEW) ? "open" : "edit";
|
wchar_t const * action = (mode == VIEW) ? L"open" : L"edit";
|
||||||
bool success = reinterpret_cast<long>(ShellExecute(NULL, action,
|
bool success = reinterpret_cast<long>(ShellExecuteW(NULL, action,
|
||||||
win_path.c_str(), NULL, NULL, 1)) > 32;
|
reinterpret_cast<wchar_t const *>(win_path.utf16()),
|
||||||
|
NULL, NULL, 1)) > 32;
|
||||||
|
|
||||||
if (!path.empty() && !lyxrc.texinputs_prefix.empty()) {
|
if (!path.empty() && !lyxrc.texinputs_prefix.empty()) {
|
||||||
setEnv("TEXINPUTS", oldtexinputs);
|
setEnv("TEXINPUTS", oldtexinputs);
|
||||||
|
@ -567,18 +567,13 @@ bool autoOpenFile(string const & filename, auto_open_mode const mode,
|
|||||||
setEnv("TEXFONTS", newtexfonts);
|
setEnv("TEXFONTS", newtexfonts);
|
||||||
}
|
}
|
||||||
|
|
||||||
string fname8;
|
QString const wname = toqstr(filename);
|
||||||
try {
|
|
||||||
fname8 = to_local8bit(from_utf8(filename));
|
|
||||||
} catch (...) {
|
|
||||||
LYXERR0("Cannot encode file name `" << filename << "' to local 8 bit encoding");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// reference: http://msdn.microsoft.com/en-us/library/bb762153.aspx
|
// reference: http://msdn.microsoft.com/en-us/library/bb762153.aspx
|
||||||
char const * action = (mode == VIEW) ? "open" : "edit";
|
wchar_t const * action = (mode == VIEW) ? L"open" : L"edit";
|
||||||
bool success = reinterpret_cast<intptr_t>(ShellExecute(NULL, action,
|
bool success = reinterpret_cast<intptr_t>(ShellExecuteW(NULL, action,
|
||||||
fname8.c_str(), NULL, NULL, 1)) > 32;
|
reinterpret_cast<wchar_t const *>(wname.utf16()),
|
||||||
|
NULL, NULL, 1)) > 32;
|
||||||
|
|
||||||
if (!path.empty() && !lyxrc.texinputs_prefix.empty()) {
|
if (!path.empty() && !lyxrc.texinputs_prefix.empty()) {
|
||||||
setEnv("TEXINPUTS", oldtexinputs);
|
setEnv("TEXINPUTS", oldtexinputs);
|
||||||
|
Loading…
Reference in New Issue
Block a user