]> git.lyx.org Git - lyx.git/blob - src/support/rename.cpp
fix linking error in the frontend
[lyx.git] / src / support / rename.cpp
1 /**
2  * \file rename.cpp
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 #include "support/FileName.h"
15
16 #include <cstdio>
17
18
19 namespace lyx {
20 namespace support {
21
22
23 using std::string;
24
25
26 bool rename(FileName const & from, FileName const & to)
27 {
28         if (::rename(from.toFilesystemEncoding().c_str(), to.toFilesystemEncoding().c_str()) == -1)
29                 if (copy(from, to)) {
30                         unlink(from);
31                         return true;
32                 } else
33                         return false;
34         return true;
35 }
36
37
38 } // namespace support
39 } // namespace lyx