]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/CDMUtilities.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / CDMUtilities.cpp
index 4d409542b221dfb2ae83a975d1d1ece393d412d2..ac1b5322159a1930f9bf07bc54559499c76d4cc3 100644 (file)
@@ -87,7 +87,7 @@ namespace CDMUtilities
        if(0 < pathSplit.size())
                pathFixed = pathSplit[0];
 
-    for (int i = 1; i < pathSplit.size(); i++)
+    for (int i = 1; i < (int)(pathSplit.size()); i++)
       {
         pathFixed += CDMUtilities::SLASH + pathSplit[i];
       }
@@ -112,7 +112,8 @@ namespace CDMUtilities
     std::string command = TEXT_EDITOR;
 
     if(file != "")
-      command += " \"" + file + "\" &";
+      command += " \"" + file + "\"";
+    command += " &";
 
     return system(command.c_str());
   }
@@ -122,7 +123,8 @@ namespace CDMUtilities
     std::string command = FILE_EXPLORER;
 
     if(file != "")
-      command += " \"" + file + "\" &";
+      command += " \"" + file + "\"";
+    command += " &";
 
     return system(command.c_str());
   }
@@ -131,7 +133,8 @@ namespace CDMUtilities
   {
     std::string comm = command;
     if(file != "")
-      comm += " \"" + file + "\" &";
+      comm += " \"" + file + "\"";
+    comm += " &";
 
     return system(comm.c_str());
   }
@@ -144,7 +147,12 @@ namespace CDMUtilities
 
   int openCreaToolsTools()
   {
+#ifdef _WIN32
+    std::string comm = "creaTools &";
+#else
     std::string comm = "creaTools.sh &";
+#endif
+    
     return system(comm.c_str());
   }
 
@@ -162,7 +170,7 @@ namespace CDMUtilities
     std::vector<std::string> words;
     splitter::split(words,name," \\/\",.'`",splitter::no_empties);
     std::string fixedName = "";
-    for (int i = 0; i < words.size(); i++)
+    for (int i = 0; i < (int)(words.size()); i++)
       {
         fixedName += words[i];
       }
@@ -305,4 +313,18 @@ namespace CDMUtilities
     return true;
   }
 
+  std::string stringify(const std::string& line)
+  {
+       std::string res;
+       for (int i = 0; i < (int)(line.size()); i++)
+       {
+         if(line[i] == '\\')
+           res.push_back('\\');
+         if(line[i] == '\"')
+           res.push_back('\\');
+         res.push_back(line[i]);
+       }
+       return res;
+  }
+
 }