Browse Source

made project name from cmakelists.txt more flexible

master
tedjk 11 years ago
parent
commit
7eeb0470ac
  1. 17
      juci/directories.cc
  2. 1
      juci/directories.h

17
juci/directories.cc

@ -95,20 +95,31 @@ get_project_name(const boost::filesystem::path& dir_path) {
size_t variabel_end = line.find("}", variabel_start);
project_name_var = line.substr(variabel_start+1,
(variabel_end)-variabel_start-1);
boost::algorithm::trim(project_name_var);
if (variabel_start == std::string::npos) { // not a variabel
variabel_start = line.find("(", 0);
variabel_end = line.find(")", variabel_start);
return line.substr(variabel_start+1,
(variabel_end)-variabel_start-1);
}
break;
}
}
std::ifstream ifs2(itr->path().string());
while (std::getline(ifs2, line)) {
if (line.find("set("+project_name_var, 0) != std::string::npos) {
if (line.find("set(", 0) != std::string::npos
|| line.find("set (", 0) != std::string::npos) {
if( line.find(project_name_var, 0) != std::string::npos) {
size_t variabel_start = line.find(project_name_var, 0)
+project_name_var.length();
size_t variabel_end = line.find(")", variabel_start);
project_name = line.substr(variabel_start,
variabel_end-variabel_start);
project_name = line.substr(variabel_start+1,
variabel_end-variabel_start-1);
boost::algorithm::trim(project_name);
return project_name;
}
}
}
break;
}
}

1
juci/directories.h

@ -4,6 +4,7 @@
#include <gtkmm.h>
#include <glib.h>
#include "boost/filesystem.hpp"
#include "boost/algorithm/string.hpp"
#include <utility>
#include <algorithm>
#include <iostream>

Loading…
Cancel
Save