]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/CDMUtilities.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / CDMUtilities.cpp
index 0149e8dbd5488000f8481549c1570bf5fe3b2070..f0a538e00ee124e2114a4a79cab2e0edc88c1864 100644 (file)
@@ -36,6 +36,7 @@
 
 #include<vector>
 #include<string>
+#include <cstdlib>
 
 namespace CDMUtilities
 {
@@ -82,14 +83,62 @@ namespace CDMUtilities
     //break path into folders
     std::vector<std::string> pathSlpit;
 
-    splitter::split(pathSlpit, path, "/", splitter::no_empties);
+    splitter::split(pathSlpit, path, CDMUtilities::SLASH, splitter::no_empties);
 
     for (int i = 0; i < pathSlpit.size(); i++)
       {
-        pathFixed += "/" + pathSlpit[i];
+        pathFixed += CDMUtilities::SLASH + pathSlpit[i];
       }
 #endif
     return pathFixed;
 
   }
+
+  int openTextEditor(const std::string& file)
+  {
+    std::string command = TEXT_EDITOR;
+
+    if(file != "")
+      command += " \"" + file + "\" &";
+
+    return system(command.c_str());
+  }
+
+  int openFileExplorer(const std::string& file)
+  {
+    std::string command = FILE_EXPLORER;
+
+    if(file != "")
+      command += " \"" + file + "\" &";
+
+    return system(command.c_str());
+  }
+
+  int openFileWithCommand(const std::string& file, const std::string& command)
+  {
+    std::string comm = command;
+    if(file != "")
+      comm += " \"" + file + "\" &";
+
+    return system(comm.c_str());
+  }
+
+  int openBBEditor()
+  {
+    std::string comm = "bbEditor &";
+    return system(comm.c_str());
+  }
+
+  int openCreaToolsTools()
+  {
+    std::string comm = "creaTools.sh &";
+    return system(comm.c_str());
+  }
+
+  int openTerminal()
+  {
+    std::string comm = TERMINAL + "&";
+    return system(comm.c_str());
+  }
+
 }