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>
24 #if defined(HAVE_CHMOD) && defined(_MSC_VER)
37 bool lyx::support::chmod(string const & file, unsigned long int mode)
40 if (::chmod(file.c_str(), mode_t(mode)) != 0)
44 # warning "File permissions are ignored on this system."
51 bool lyx::support::copy(string const & from, string const & to, unsigned long int mode)
53 ifstream ifs(from.c_str(), ios::binary | ios::in);
57 if (mode != (unsigned long int)-1) {
58 ofstream ofs(to.c_str(), ios::binary | ios::out | ios::trunc);
62 if (!chmod(to, mode_t(mode)))
66 ofstream ofs(to.c_str(), ios::binary | ios::out | ios::trunc);