Skip to content

Commit

Permalink
Передвинем хак для M#2922 в более подходящее место и упростим его.
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Feb 3, 2016
1 parent 1256596 commit a49b16b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 28 deletions.
6 changes: 5 additions & 1 deletion 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.

Expand Down
44 changes: 18 additions & 26 deletions far/execute.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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<string> 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())); }));
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
@@ -1 +1 @@
m4_define(BUILD,4538)m4_dnl
m4_define(BUILD,4539)m4_dnl

0 comments on commit a49b16b

Please sign in to comment.