Skip to content

Commit 8f37917

Browse files
committed
Replace annoying which call with linuxdeploy's implementation
Fixes #56.
1 parent fcf096a commit 8f37917

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

src/util.cpp

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// library headers
2+
#include <linuxdeploy/util/util.h>
3+
14
// local headers
25
#include "util.h"
36

@@ -19,28 +22,6 @@ procOutput check_command(const std::vector<std::string> &args) {
1922
return {returnCode == 0, returnCode, out, err};
2023
}
2124

22-
boost::filesystem::path which(const std::string &name) {
23-
subprocess::Popen proc({"which", name.c_str()}, subprocess::output(subprocess::PIPE));
24-
auto output = proc.communicate();
25-
26-
using namespace linuxdeploy::core::log;
27-
28-
ldLog() << LD_DEBUG << "Calling 'which" << name << LD_NO_SPACE << "'" << std::endl;
29-
30-
if (proc.retcode() != 0) {
31-
ldLog() << LD_DEBUG << "which call failed, exit code:" << proc.retcode() << std::endl;
32-
return "";
33-
}
34-
35-
std::string path = output.first.buf.data();
36-
37-
while (path.back() == '\n') {
38-
path.erase(path.end() - 1, path.end());
39-
}
40-
41-
return path;
42-
}
43-
4425
std::map<std::string, std::string> queryQmake(const boost::filesystem::path& qmakePath) {
4526
auto qmakeCall = check_command({qmakePath.string(), "-query"});
4627

@@ -95,10 +76,10 @@ boost::filesystem::path findQmake() {
9576
ldLog() << "Using user specified qmake:" << qmakePath << std::endl;
9677
} else {
9778
// search for qmake
98-
qmakePath = which("qmake-qt5");
79+
qmakePath = linuxdeploy::util::which("qmake-qt5");
9980

10081
if (qmakePath.empty())
101-
qmakePath = which("qmake");
82+
qmakePath = linuxdeploy::util::which("qmake");
10283
}
10384

10485
return qmakePath;

src/util.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ typedef struct {
2222

2323
procOutput check_command(const std::vector<std::string> &args);
2424

25-
boost::filesystem::path which(const std::string &name);
26-
2725
template<typename Iter>
2826
std::string join(Iter beg, Iter end) {
2927
std::stringstream rv;

0 commit comments

Comments
 (0)