3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
8 * Full author contact details are available in file CREDITS.
15 #include "support/lyxlib.h"
17 #ifdef HAVE_SYS_STAT_H
18 # include <sys/stat.h>
20 #ifdef HAVE_SYS_TYPES_H
21 # include <sys/types.h>
34 bool lyx::support::chmod(string const & file, unsigned long int mode)
37 if (::chmod(file.c_str(), mode_t(mode)) != 0)
41 # warning "File permissions are ignored on this system."
48 bool lyx::support::copy(string const & from, string const & to, unsigned long int mode)
50 ifstream ifs(from.c_str(), ios::binary | ios::in);
54 if (mode != (unsigned long int)-1) {
55 ofstream ofs(to.c_str(), ios::binary | ios::out | ios::trunc);
59 if (!chmod(to, mode_t(mode)))
63 ofstream ofs(to.c_str(), ios::binary | ios::out | ios::trunc);