summaryrefslogtreecommitdiff
path: root/src/handle_dep.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-12-06 03:09:39 (GMT)
committerMarius Kintel <marius@kintel.net>2011-12-06 03:09:39 (GMT)
commitae30a7978475f8e5bc8272fd1e073fae7f4bd3ed (patch)
tree35de3d04d39d9a767cf828f68713cdd82262213d /src/handle_dep.cc
parent0d6b87dd0e28e53ec4601443c7d06dbb66628d47 (diff)
Ported from QFileInfo to boost::filesystem
Diffstat (limited to 'src/handle_dep.cc')
-rw-r--r--src/handle_dep.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/handle_dep.cc b/src/handle_dep.cc
index d4380f5..99a0df7 100644
--- a/src/handle_dep.cc
+++ b/src/handle_dep.cc
@@ -2,24 +2,25 @@
#include <string>
#include <sstream>
#include <QString>
-#include <QDir>
-#include <QSet>
#include <stdlib.h> // for system()
#include <boost/unordered_set.hpp>
#include <boost/foreach.hpp>
+#include <boost/filesystem.hpp>
+using namespace boost::filesystem;
boost::unordered_set<std::string> dependencies;
const char *make_command = NULL;
void handle_dep(const std::string &filename)
{
- if (filename[0] == '/')
+ path filepath(filename);
+ if (filepath.is_absolute()) {
dependencies.insert(filename);
+ }
else {
- QString dep = QDir::currentPath() + QString("/") + QString::fromStdString(filename);
- dependencies.insert(dep.toStdString());
+ dependencies.insert((current_path() / filepath).native());
}
- if (!QFile(QString::fromStdString(filename)).exists() && make_command) {
+ if (!exists(filepath) && make_command) {
std::stringstream buf;
buf << make_command << " '" << QString::fromStdString(filename).replace("'", "'\\''").toUtf8().data() << "'";
system(buf.str().c_str()); // FIXME: Handle error
contact: Jan Huwald // Impressum