diff options
Diffstat (limited to 'src/handle_dep.cc')
-rw-r--r-- | src/handle_dep.cc | 13 |
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 |