X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2FcreaDevManagerLib%2FmodelCDMCMakeListsFile.cpp;h=2dc48b478d29cdaac5926dc1655e42bcad209e79;hb=5ff0bb2664c3cd508c1dd438666a71b8a96459c3;hp=2b9cb2af8817fcf03bbef22ec0a6b78d797a5c27;hpb=609d8d48cae96384e664ec6b000e8ecfcbad6459;p=crea.git diff --git a/lib/creaDevManagerLib/modelCDMCMakeListsFile.cpp b/lib/creaDevManagerLib/modelCDMCMakeListsFile.cpp index 2b9cb2a..2dc48b4 100644 --- a/lib/creaDevManagerLib/modelCDMCMakeListsFile.cpp +++ b/lib/creaDevManagerLib/modelCDMCMakeListsFile.cpp @@ -34,6 +34,8 @@ #include "modelCDMCMakeListsFile.h" +#include + #include #include @@ -43,14 +45,20 @@ modelCDMCMakeListsFile::modelCDMCMakeListsFile() { } -modelCDMCMakeListsFile::modelCDMCMakeListsFile(const std::string& path, - const int& level) +modelCDMCMakeListsFile::modelCDMCMakeListsFile(modelCDMIProjectTreeNode* parent, const std::string& path, const std::string& name, const int& level) { + std::cout << "creating cmakelist file: " + path + "\n"; + this->parent = parent; this->children.clear(); this->level = level; this->type = wxDIR_FILES; - this->name = "CMakeFileLists.txt"; + this->name = name; this->path = path; + + std::ifstream in(path.c_str(), std::ifstream::in | std::ifstream::binary); + in.seekg(0, std::ifstream::end); + this->length = in.tellg(); + in.close(); } modelCDMCMakeListsFile::~modelCDMCMakeListsFile() @@ -71,6 +79,16 @@ bool modelCDMCMakeListsFile::OpenFile(std::string*& result) const bool modelCDMCMakeListsFile::Refresh(std::string*& result) { - //TODO: implement method + //std::cout << "refreshing cmakelists" << std::endl; + std::ifstream in((this->path).c_str()); + if(!in.is_open()) + { + in.close(); + return false; + } + std::ifstream in2(path.c_str(), std::ifstream::in | std::ifstream::binary); + in2.seekg(0, std::ifstream::end); + this->length = in2.tellg(); + in2.close(); return true; }