]> git.lyx.org Git - lyx.git/blob - src/support/rename.C
hopefully fix tex2lyx linking.
[lyx.git] / src / support / rename.C
1 /**
2  * \file rename.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "support/lyxlib.h"
14
15 #include <cstdio>
16
17
18 namespace lyx {
19
20
21 using std::string;
22
23
24 bool lyx::support::rename(string const & from, string const & to)
25 {
26         if (::rename(from.c_str(), to.c_str()) == -1)
27                 if (copy(from, to)) {
28                         unlink(from);
29                         return true;
30                 } else
31                         return false;
32         return true;
33 }
34
35
36 } // namespace lyx