Fixed bad permission access that caused an application loop

This commit is contained in:
emeric
2020-05-20 23:17:30 +02:00
parent 790bc3bad1
commit 4e998fd507
2 changed files with 23 additions and 5 deletions
+17 -3
View File
@@ -54,10 +54,24 @@ Transcoder::Transcoder(const std::filesystem::path& filePath, const TranscodePar
bool
Transcoder::start()
{
if (!std::filesystem::exists(_filePath))
return false;
else if (!std::filesystem::is_regular_file( _filePath) )
try
{
if (!std::filesystem::exists(_filePath))
{
LOG(ERROR) << "File '" << _filePath << "' does not exist!";
return false;
}
else if (!std::filesystem::is_regular_file( _filePath) )
{
LOG(ERROR) << "File '" << _filePath << "' is not regular!";
return false;
}
}
catch (const std::filesystem::filesystem_error& e)
{
LOG(ERROR) << "File error on '" << _filePath.string() << "': " << e.what();
return false;
}
LOG(INFO) << "Transcoding file '" << _filePath.string() << "'";