mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-03 11:21:41 +02:00
Use "which" instead of "whereis" to find the streaming executable.
This commit is contained in:
parent
2ba365b1a1
commit
e355a559eb
1 changed files with 5 additions and 9 deletions
|
@ -45,7 +45,7 @@ ProcessStream::~ProcessStream()
|
|||
}
|
||||
|
||||
|
||||
bool ProcessStream::fileExists(const std::string& filename)
|
||||
bool ProcessStream::fileExists(const std::string& filename)
|
||||
{
|
||||
struct stat buffer;
|
||||
return (stat(filename.c_str(), &buffer) == 0);
|
||||
|
@ -62,14 +62,10 @@ std::string ProcessStream::findExe(const std::string& filename)
|
|||
if (exe.find("/") != string::npos)
|
||||
exe = exe.substr(exe.find_last_of("/") + 1);
|
||||
|
||||
/// check with "whereis"
|
||||
string whereis = execGetOutput("whereis " + exe);
|
||||
if (whereis.find(":") != std::string::npos)
|
||||
{
|
||||
whereis = trim_copy(whereis.substr(whereis.find(":") + 1));
|
||||
if (!whereis.empty())
|
||||
return whereis;
|
||||
}
|
||||
/// check with "which"
|
||||
string which = execGetOutput("which " + exe);
|
||||
if (!which.empty())
|
||||
return which;
|
||||
|
||||
/// check in the same path as this binary
|
||||
char buff[PATH_MAX];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue