/* Copyright (c) MediaArea.net SARL. All Rights Reserved. * * Use of this source code is governed by a BSD-style license that can * be found in the License.html file in the root of the source tree. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/ExternalCommandHelpers.h" #ifdef WINDOWS #include #include #include #else #include #include #include #endif //WINDOWS #include #include #include using namespace std; using namespace ZenLib; namespace MediaInfoLib { //--------------------------------------------------------------------------- const ZtringList ffmpeg_PossibleNames= // Hack, ZtringList needs to handle C++11 style static initialization { #ifdef WINDOWS __T("ffmpeg-ma.exe;ffmpeg.exe") #else __T("ffmpeg-ma;ffmpeg") #endif //WINDOWS }; //--------------------------------------------------------------------------- Ztring External_Command_Exists(const ZtringList& PossibleNames) { #ifndef WINDOWS_UWP Ztring Path; #ifdef WINDOWS Ztring ExeDirectory; DWORD EnvPathLen=GetEnvironmentVariableW(L"PATH", nullptr, 0); if (EnvPathLen) { wchar_t* EnvPath=new wchar_t[EnvPathLen+1]; EnvPathLen=GetEnvironmentVariableW(L"PATH", EnvPath, EnvPathLen+1); if (EnvPathLen>0 && EnvPathLen0 && ExePathLen