From a49b16bb88b0409f2349a4c0b0d24c8242e039bb Mon Sep 17 00:00:00 2001 From: Alex Alabuzhev Date: Wed, 3 Feb 2016 17:27:53 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B4=D0=B2=D0=B8?= =?UTF-8?q?=D0=BD=D0=B5=D0=BC=20=D1=85=D0=B0=D0=BA=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?M#2922=20=D0=B2=20=D0=B1=D0=BE=D0=BB=D0=B5=D0=B5=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B4=D1=85=D0=BE=D0=B4=D1=8F=D1=89=D0=B5=D0=B5=20=D0=BC=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=BE=20=D0=B8=20=D1=83=D0=BF=D1=80=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B8=D0=BC=20=D0=B5=D0=B3=D0=BE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- far/changelog | 6 +++++- far/execute.cpp | 44 ++++++++++++++++++-------------------------- far/vbuild.m4 | 2 +- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/far/changelog b/far/changelog index f349f69613..affefffb79 100644 --- a/far/changelog +++ b/far/changelog @@ -1,4 +1,8 @@ -w17 03.02.2016 17:48:03 +0300 - build 4538 +drkns 03.02.2016 19:25:05 +0200 - build 4539 + +1. Передвинем хак для M#2922 в более подходящее место и упростим его. + +w17 03.02.2016 17:48:03 +0300 - build 4538 1. Уточнение 4537. diff --git a/far/execute.cpp b/far/execute.cpp index 9ab82ab324..749bf8a4b3 100644 --- a/far/execute.cpp +++ b/far/execute.cpp @@ -702,11 +702,6 @@ bool Execute(execute_info& Info, bool FolderRun, bool Silent, const std::functio } const auto strComspec(os::env::get_variable(L"COMSPEC")); - if (strComspec.empty() && !Info.DirectRun) - { - Message(MSG_WARNING, 1, MSG(MError), MSG(MComspecNotFound), MSG(MOk)); - return false; - } DWORD dwSubSystem = IMAGE_SUBSYSTEM_UNKNOWN; os::handle Process; @@ -810,6 +805,18 @@ bool Execute(execute_info& Info, bool FolderRun, bool Silent, const std::functio string ComSpecParams(Global->Opt->Exec.strComSpecParams); ComSpecParams += L" "; + + // ShellExecuteEx Win8.1+ wrongly opens symlinks in the separate console window + // Workaround: execute through %comspec% + if (Info.DirectRun && !Info.NewWindow && IsWindows8Point1OrGreater()) + { + os::fs::file_status fstatus(strNewCmdStr); + if (os::fs::is_file(fstatus) && fstatus.check(FILE_ATTRIBUTE_REPARSE_POINT)) + { + Info.DirectRun = false; + } + } + if (Info.DirectRun) { seInfo.lpFile = strNewCmdStr.data(); @@ -826,6 +833,12 @@ bool Execute(execute_info& Info, bool FolderRun, bool Silent, const std::functio } else { + if (strComspec.empty()) + { + Message(MSG_WARNING, 1, MSG(MError), MSG(MComspecNotFound), MSG(MOk)); + return false; + } + std::vector NotQuotedShellList; split(NotQuotedShellList, os::env::expand_strings(Global->Opt->Exec.strNotQuotedShell), STLF_UNIQUE); bool bQuotedShell = !(std::any_of(CONST_RANGE(NotQuotedShellList, i) { return !StrCmpI(i,PointToName(strComspec.data())); })); @@ -874,27 +887,6 @@ bool Execute(execute_info& Info, bool FolderRun, bool Silent, const std::functio } } - // ShellExecuteEx Win8.1+ wrongly opens symlinks in the separate console window - // Workaround: cmd /c Syslink.exe - string strParams; - if (seInfo.nShow == SW_SHOWNORMAL && !Info.NewWindow && IsWindows8Point1OrGreater()) - { - if (seInfo.lpFile && seInfo.lpVerb && wcscmp(seInfo.lpVerb, L"open") == 0 && !strComspec.empty()) - { - os::fs::file_status fstatus(seInfo.lpFile); - if (os::fs::is_file(fstatus) && fstatus.check(FILE_ATTRIBUTE_REPARSE_POINT)) - { - string fname(seInfo.lpFile); - strParams = ComSpecParams + L" " + QuoteSpace(fname); - if (seInfo.lpParameters && seInfo.lpParameters[0]) - strParams += string(L" ") + seInfo.lpParameters; - - seInfo.lpFile = strComspec.data(); - seInfo.lpParameters = strParams.data(); - } - } - } - Result = ShellExecuteEx(&seInfo) != FALSE; if (Result) diff --git a/far/vbuild.m4 b/far/vbuild.m4 index b50d3da086..73589558a6 100644 --- a/far/vbuild.m4 +++ b/far/vbuild.m4 @@ -1 +1 @@ -m4_define(BUILD,4538)m4_dnl +m4_define(BUILD,4539)m4_dnl