Small tweak to VapourSynth detection.

This commit is contained in:
LoRd_MuldeR 2019-08-05 22:55:10 +02:00
parent bdd55a654a
commit e763eeae5b
2 changed files with 10 additions and 18 deletions

View File

@ -46,7 +46,7 @@ QScopedPointer<QFile> VapourSynthCheckThread::m_vpsDllPath[2];
//Const //Const
static const char* const VPS_REG_KEYS = "SOFTWARE\\VapourSynth"; static const char* const VPS_REG_KEYS = "SOFTWARE\\VapourSynth";
static const char* const VPS_REG_NAME = "Path"; static const char* const VPS_REG_NAME = "VapourSynthDLL";
//Default VapurSynth architecture //Default VapurSynth architecture
#if _WIN64 || __x86_64__ #if _WIN64 || __x86_64__
@ -62,21 +62,12 @@ static const char* const VPS_REG_NAME = "Path";
// Auxilary functions // Auxilary functions
//------------------------------------- //-------------------------------------
#define VALID_DIR(STR) ((!(STR).isEmpty()) && QDir((STR)).exists())
#define BOOLIFY(X) ((X) ? '1' : '0') #define BOOLIFY(X) ((X) ? '1' : '0')
#define VPS_BITNESS(X) (((X) + 1U) * 32U) #define VPS_BITNESS(X) (((X) + 1U) * 32U)
static inline QString& cleanDir(QString& path) static inline bool VALID_DIR(const QString &path)
{ {
if (!path.isEmpty()) return (!path.isEmpty()) && QDir(path).exists();
{
path = QDir::fromNativeSeparators(path);
while (path.endsWith('/'))
{
path.chop(1);
}
}
return path;
} }
//------------------------------------- //-------------------------------------
@ -205,13 +196,14 @@ int VapourSynthCheckThread::threadMain(void)
{ {
if (MUtils::Registry::reg_key_exists(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_KEYS), REG_SCOPE[i])) if (MUtils::Registry::reg_key_exists(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_KEYS), REG_SCOPE[i]))
{ {
QString vpsInstallPath; QString vpsDllPath;
if (MUtils::Registry::reg_value_read(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_KEYS), QString::fromLatin1(VPS_REG_NAME), vpsInstallPath, REG_SCOPE[i])) if (MUtils::Registry::reg_value_read(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_KEYS), QString::fromLatin1(VPS_REG_NAME), vpsDllPath, REG_SCOPE[i]))
{ {
if (VALID_DIR(vpsInstallPath)) const QFileInfo vpsDllInfo(QDir::fromNativeSeparators(vpsDllPath));
if (vpsDllInfo.exists() && vpsDllInfo.isFile())
{ {
const QString vpsCorePath = QString("%1/core").arg(cleanDir(vpsInstallPath)); const QString vpsCorePath = vpsDllInfo.canonicalPath();
if (VALID_DIR(vpsCorePath)) if (!vpsCorePath.isEmpty())
{ {
const int flag = getVapourSynthType(REG_SCOPE[i]); const int flag = getVapourSynthType(REG_SCOPE[i]);
if (!vapoursynthPath.contains(flag)) if (!vapoursynthPath.contains(flag))

View File

@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2 #define VER_X264_MAJOR 2
#define VER_X264_MINOR 9 #define VER_X264_MINOR 9
#define VER_X264_PATCH 2 #define VER_X264_PATCH 2
#define VER_X264_BUILD 1176 #define VER_X264_BUILD 1178
#define VER_X264_PORTABLE_EDITION (0) #define VER_X264_PORTABLE_EDITION (0)