From 40a9344d44a4f0e6194fd9b9577d13af0eeeeaaf Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Tue, 27 Sep 2022 23:17:54 +0200 Subject: [PATCH] vapoursynth: Check if file exists before creating provider Since FileNotFound exceptions don't abort the provider search, opening an invalid path would show errors such as "vapoursynth not found" when VapourSynth wasn't installed, even if VapourSynth wasn't selected as the default video provider. --- src/audio_provider_vs.cpp | 2 +- src/video_provider_vs.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio_provider_vs.cpp b/src/audio_provider_vs.cpp index e66779502..575daaad6 100644 --- a/src/audio_provider_vs.cpp +++ b/src/audio_provider_vs.cpp @@ -54,7 +54,6 @@ public: }; VapoursynthAudioProvider::VapoursynthAudioProvider(agi::fs::path const& filename) try { - agi::acs::CheckFileRead(filename); std::lock_guard lock(vs.GetMutex()); script = vs.GetScriptAPI()->createScript(nullptr); @@ -162,6 +161,7 @@ VapoursynthAudioProvider::~VapoursynthAudioProvider() { } std::unique_ptr CreateVapoursynthAudioProvider(agi::fs::path const& file, agi::BackgroundRunner *) { + agi::acs::CheckFileRead(file); return agi::make_unique(file); } #endif diff --git a/src/video_provider_vs.cpp b/src/video_provider_vs.cpp index fa5dfdbf1..a0a006f43 100644 --- a/src/video_provider_vs.cpp +++ b/src/video_provider_vs.cpp @@ -105,7 +105,6 @@ void VapoursynthVideoProvider::SetResizeArg(VSMap *args, const VSMap *props, con } VapoursynthVideoProvider::VapoursynthVideoProvider(agi::fs::path const& filename, std::string const& colormatrix) try { - agi::acs::CheckFileRead(filename); std::lock_guard lock(vs.GetMutex()); script = vs.GetScriptAPI()->createScript(nullptr); @@ -277,6 +276,7 @@ VapoursynthVideoProvider::~VapoursynthVideoProvider() { namespace agi { class BackgroundRunner; } std::unique_ptr CreateVapoursynthVideoProvider(agi::fs::path const& path, std::string const& colormatrix, agi::BackgroundRunner *) { + agi::acs::CheckFileRead(path); return agi::make_unique(path, colormatrix); } #endif // WITH_VAPOURSYNTH