]> git.lyx.org Git - lyx.git/blob - src/support/copy.C
7324d445681efc00ab011cf22b5a32e9714fb75f
[lyx.git] / src / support / copy.C
1 #include <config.h>
2
3 #include <fstream>
4
5 //#include <stdio.h>
6
7 #include "support/lyxlib.h"
8 #include "LString.h"
9 //#include "support/syscall.h"
10 #include "support/filetools.h"
11
12 bool lyx::copy(string const & from, string const & to)
13 {
14 #if 0
15         string command = "cp " + QuoteName(from) + " " + QuoteName(to);
16         return Systemcalls().startscript(Systemcalls::System,
17                                          command) == 0;
18 #else
19         std::ifstream ifs(from.c_str());
20         if (!ifs) return false;
21         std::ofstream ofs(to.c_str(), std::ios::out|std::ios::trunc);
22         if (!ofs) return false;
23         ofs << ifs.rdbuf();
24         if (ofs.good()) return true;
25         return false;
26 #endif
27 }