From 85465dd7a548769a2c76cec50b65a47abcdf0e65 Mon Sep 17 00:00:00 2001 From: Brendan Le Glaunec Date: Fri, 22 Jun 2018 15:38:27 +0200 Subject: [PATCH] Improve code quality --- src/file_input.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/file_input.cpp b/src/file_input.cpp index c50a7a6..5d579b9 100644 --- a/src/file_input.cpp +++ b/src/file_input.cpp @@ -85,10 +85,11 @@ gboolean bus_callback(GstBus *bus, GstMessage *msg, gpointer data) { return TRUE; } -inline bool file_exists (const std::string& name) { +inline bool file_exists(const std::string& name) { struct stat buffer; + std::string corrected_name = name.substr(5); - return (stat (corrected_name.c_str(), &buffer) == 0); + return (stat(corrected_name.c_str(), &buffer) == 0); } bool configure_file_input(t_server *serv) { @@ -109,11 +110,10 @@ bool configure_file_input(t_server *serv) { g_signal_connect(serv->factory, "media-configure", (GCallback)media_configure, app); - if (file_exists(input_path)) { - return true; - } - else { + if (!file_exists(input_path)) { std::cerr << "Can't access " << input_path.c_str() << std::endl; + return false; } - return false; + + return true; }