ref: refs/heads/master
commit 745e6e1a0fe7e53379e0dee651a1ca1880036479
Author: Duncan Mac-Vicar P
Date: Thu Feb 5 18:05:38 2009 +0100
use which instead of whereis, at least gives a error code back
---
zypp/media/MediaAria2c.cc | 25 +++++++------------------
1 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/zypp/media/MediaAria2c.cc b/zypp/media/MediaAria2c.cc
index 8720c7f..3ae518e 100644
--- a/zypp/media/MediaAria2c.cc
+++ b/zypp/media/MediaAria2c.cc
@@ -63,20 +63,13 @@ MediaAria2c::existsAria2cmd()
{
const char* argv[] =
{
- "whereis",
- "-b",
+ "which",
"aria2c",
NULL
};
ExternalProgram aria(argv, ExternalProgram::Stderr_To_Stdout);
-
- std::string ariaResponse( aria.receiveLine());
- string::size_type pos = ariaResponse.find('/', 0 );
- if( pos != string::npos )
- return true;
- else
- return false;
+ return ( aria.close() == 0 );
}
static const char *const anonymousIdHeader()
@@ -610,8 +603,7 @@ Pathname MediaAria2c::whereisAria2c()
const char* argv[] =
{
- "whereis",
- "-b",
+ "which",
"aria2c",
NULL
};
@@ -619,15 +611,12 @@ Pathname MediaAria2c::whereisAria2c()
ExternalProgram aria(argv, ExternalProgram::Stderr_To_Stdout);
std::string ariaResponse( aria.receiveLine());
- aria.close();
+ int code = aria.close();
- string::size_type pos = ariaResponse.find('/', 0 );
- if( pos != string::npos )
+ if( code == 0 )
{
- aria2cPathr = ariaResponse;
- string::size_type pose = ariaResponse.find(' ', pos + 1 );
- aria2cPathr = ariaResponse.substr( pos , pose - pos );
- MIL << "We will use aria2c located here: " << ariaResponse.substr( pos , pose - pos) << endl;
+ aria2cPathr = str::trim(ariaResponse);
+ MIL << "We will use aria2c located here: " << aria2cPathr << endl;
}
else
{
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org