]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/modelCDMFile.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / modelCDMFile.cpp
index 8e8a40faa5966dfb828dc6a157db3071399cfcfb..6767b98e8895a5f87dc5edb7e2153de58a7360b9 100644 (file)
@@ -69,14 +69,36 @@ modelCDMFile::~modelCDMFile()
 {
 }
 
-bool modelCDMFile::OpenFile(std::string*& result)
+bool modelCDMFile::OpenFile(std::string*& result, const std::string& command)
 {
-  //TODO: implement method
+  if (!CDMUtilities::openFileWithCommand(path, command))
     return true;
+  else
+    {
+      result = new std::string("Couldn't open file with command " + command + ".");
+      return false;
+    }
 }
 
 const bool modelCDMFile::Refresh(std::string*& result)
 {
-  //TODO: implement method
+  std::ifstream in((this->path).c_str());
+  if(!in.is_open())
+    {
+      in.close();
+      return false;
+    }
+  return true;
+}
+
+const bool modelCDMFile::OpenInFileExplorer(std::string*& result) const
+{
+  std::string pth = this->path.substr(0, path.size() - name.size() - 1);
+  if (!CDMUtilities::openFileExplorer(pth))
     return true;
+  else
+    {
+      result = new std::string("Couldn't open file.");
+      return false;
+    }
 }