X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FmodelCDMFile.cpp;h=3f92ffe9b29a2a81e43b41db285c0860092ff0be;hb=311bdcc514f85386f3bbbef9ff6a88bf69fd930f;hp=6767b98e8895a5f87dc5edb7e2153de58a7360b9;hpb=609d8d48cae96384e664ec6b000e8ecfcbad6459;p=crea.git diff --git a/lib/creaDevManagerLib/modelCDMFile.cpp b/lib/creaDevManagerLib/modelCDMFile.cpp index 6767b98..3f92ffe 100644 --- a/lib/creaDevManagerLib/modelCDMFile.cpp +++ b/lib/creaDevManagerLib/modelCDMFile.cpp @@ -44,24 +44,19 @@ modelCDMFile::modelCDMFile() { } -modelCDMFile::modelCDMFile(const std::string& path, const int& level) +modelCDMFile::modelCDMFile(const std::string& path, const std::string& name, const int& level) { + std::cout << "creating file: " + path + "\n"; this->children.clear(); this->level = level; - - std::vector words; - std::string delimiters; - //TODO::fix for windows - delimiters = "/"; - CDMUtilities::splitter::split(words, path, delimiters, CDMUtilities::splitter::no_empties); - this->name = words[words.size()-1]; - + this->name = name; this->path = path; this->type = wxDIR_FILES; std::ifstream in(path.c_str(), std::ifstream::in | std::ifstream::binary); in.seekg(0, std::ifstream::end); this->length = in.tellg(); + in.close(); } @@ -82,12 +77,17 @@ bool modelCDMFile::OpenFile(std::string*& result, const std::string& command) const bool modelCDMFile::Refresh(std::string*& result) { + //std::cout << "refreshing file " << this->name << 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; }