]> git.lyx.org Git - lyx.git/blobdiff - src/support/copy.C
* lyxfunctional.h: delete compare_memfun and helper classes
[lyx.git] / src / support / copy.C
index 29eb28394bc3c7030852e57a3ddfad82cfcdc9dc..6ad896f1566d8e53a978155d6ba3124ad91091f8 100644 (file)
@@ -1,27 +1,37 @@
+/**
+ * \file copy.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
 #include <config.h>
 
 #include <fstream>
 
-//#include <stdio.h>
-
 #include "support/lyxlib.h"
-#include "LString.h"
-//#include "support/syscall.h"
-#include "support/filetools.h"
 
-bool lyx::copy(string const & from, string const & to)
+
+using std::ifstream;
+using std::ofstream;
+using std::ios;
+using std::string;
+
+
+bool lyx::support::copy(string const & from, string const & to)
 {
-#if 0
-       string command = "cp " + QuoteName(from) + " " + QuoteName(to);
-       return Systemcalls().startscript(Systemcalls::System,
-                                        command) == 0;
-#else
        ifstream ifs(from.c_str());
-       if (!ifs) return false;
-       ofstream ofs(to.c_str(), ios::out|ios::trunc);
-       if (!ofs) return false;
+       if (!ifs)
+               return false;
+       ofstream ofs(to.c_str(),
+                    ios::binary | ios::out | ios::trunc);
+       if (!ofs)
+               return false;
        ofs << ifs.rdbuf();
-       if (ofs.good()) return true;
+       if (ofs.good())
+               return true;
        return false;
-#endif
 }