]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/modelCDMFile.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / modelCDMFile.cpp
index 6767b98e8895a5f87dc5edb7e2153de58a7360b9..039de4784d1e55e029e84429a73f7b6ea8a0d98b 100644 (file)
@@ -44,24 +44,18 @@ modelCDMFile::modelCDMFile()
 {
 }
 
-modelCDMFile::modelCDMFile(const std::string& path, const int& level)
+modelCDMFile::modelCDMFile(const std::string& path, const std::string& name, const int& level)
 {
   this->children.clear();
   this->level = level;
-
-  std::vector<std::string> 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();
 
 }
 
@@ -88,6 +82,10 @@ const bool modelCDMFile::Refresh(std::string*& result)
       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;
 }