]> git.lyx.org Git - lyx.git/blobdiff - src/support/copy.C
remove !NEW_INSETS cruft
[lyx.git] / src / support / copy.C
index ed1fa9ea456a45afad3829646294add8f18e751d..9458c7f70411efaa5b8cd035601d7d00db3f8e11 100644 (file)
@@ -1,15 +1,17 @@
 #include <config.h>
 
-#include <stdio.h>
+#include <fstream>
 
 #include "support/lyxlib.h"
 #include "LString.h"
-#include "support/syscall.h"
-#include "support/filetools.h"
 
-bool lyx::copy(char const * from, char const * to)
+bool lyx::copy(string const & from, string const & to)
 {
-       string command = "cp " + QuoteName(from) + " " + QuoteName(to);
-       return Systemcalls().startscript(Systemcalls::System,
-                                        command) == 0;
+       std::ifstream ifs(from.c_str());
+       if (!ifs) return false;
+       std::ofstream ofs(to.c_str(), std::ios::out|std::ios::trunc);
+       if (!ofs) return false;
+       ofs << ifs.rdbuf();
+       if (ofs.good()) return true;
+       return false;
 }