Timeout.cpp
abort.cpp
convert.cpp
- copy.cpp
debug.cpp
docstream.cpp
docstring.cpp
lyxtime.cpp
mkdir.cpp
os.cpp
- rename.cpp
socktools.cpp
tempname.cpp
unicode.cpp
} else {
// Saving failed, so backup is not backup
if (madeBackup)
- rename(backupName, d->filename);
+ backupName.renameTo(d->filename);
return false;
}
}
if (!tmp_ret.empty()) {
buffer_.writeFile(tmp_ret);
// assume successful write of tmp_ret
- if (!rename(tmp_ret, fname_)) {
+ if (!tmp_ret.renameTo(fname_)) {
failed = true;
// most likely couldn't move between
// filesystems unless write of tmp_ret
FileName const out_file = makeAbsPath(database + ".bib",
buffer.masterBuffer()->temppath());
- bool const success = copy(in_file, out_file);
+ bool const success = in_file.copyTo(out_file);
if (!success) {
lyxerr << "Failed to copy '" << in_file
<< "' to '" << out_file << "'"
base = removeExtension(in_file.mangledFilename());
FileName const out_file(makeAbsPath(base + ".bst",
buffer.masterBuffer()->temppath()));
- bool const success = copy(in_file, out_file);
+ bool const success = in_file.copyTo(out_file);
if (!success) {
lyxerr << "Failed to copy '" << in_file
<< "' to '" << out_file << "'"
// the file format from the extension, so we must
// change it.
FileName const new_file = FileName(changeExtension(temp_file.absFilename(), ext));
- if (rename(temp_file, new_file)) {
+ if (temp_file.renameTo(new_file)) {
temp_file = new_file;
output_file = changeExtension(output_file, ext);
source_file = FileName(changeExtension(source_file.absFilename(), ext));
unsigned long const checksum_out = writefile.checksum();
if (checksum_in != checksum_out) {
- if (!copy(included_file, writefile)) {
+ if (!included_file.copyTo(writefile)) {
// FIXME UNICODE
LYXERR(Debug::LATEX,
to_utf8(bformat(_("Could not copy the file\n%1$s\n"
abort.cpp \
convert.cpp \
convert.h \
- copy.cpp \
copied_ptr.h \
debug.cpp \
debug.h \
Package.cpp \
Package.h \
qstring_helpers.h \
- rename.cpp \
socktools.cpp \
socktools.h \
strfwd.h \
+++ /dev/null
-/**
- * \file copy.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include <fstream>
-
-#include "support/FileName.h"
-#include "support/lyxlib.h"
-
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-using namespace std;
-
-namespace lyx {
-namespace support {
-
-static bool chmod(FileName const & file, unsigned long int mode)
-{
-#if defined (HAVE_CHMOD) && defined (HAVE_MODE_T)
- if (::chmod(file.toFilesystemEncoding().c_str(), mode_t(mode)) != 0)
- return false;
-#else
- // FIXME: "File permissions are ignored on this system."
-#endif
- return true;
-}
-
-
-bool copy(FileName const & from, FileName const & to, unsigned long int mode)
-{
- ifstream ifs(from.toFilesystemEncoding().c_str(), ios::binary | ios::in);
- if (!ifs)
- return false;
-
- if (mode != (unsigned long int)-1) {
- ofstream ofs(to.toFilesystemEncoding().c_str(),
- ios::binary | ios::out | ios::trunc);
- if (!ofs)
- return false;
- ofs.close();
- if (!support::chmod(to, mode))
- return false;
- }
-
- ofstream ofs(to.toFilesystemEncoding().c_str(),
- ios::binary | ios::out | ios::trunc);
- if (!ofs)
- return false;
-
- ofs << ifs.rdbuf();
- return ofs.good();
-}
-
-} // namespace support
-} // namespace lyx
/// get the current working directory
FileName const getcwd();
-/**
- * rename a file, returns false if it fails.
- * It can handle renames across partitions.
- */
-bool rename(FileName const & from, FileName const & to);
-/// copy a file, returns false it it fails
-bool copy(FileName const & from, FileName const & to,
- unsigned long int mode = (unsigned long int)-1);
/// FIXME: some point to this hmm ?
int kill(int pid, int sig);
/// FIXME: same here
+++ /dev/null
-/**
- * \file rename.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "support/lyxlib.h"
-#include "support/FileName.h"
-
-#include <cstdio>
-
-
-namespace lyx {
-namespace support {
-
-bool rename(FileName const & from, FileName const & to)
-{
- if (::rename(from.toFilesystemEncoding().c_str(),
- to.toFilesystemEncoding().c_str()) != -1)
- return true;
- if (!copy(from, to))
- return false;
- from.removeFile();
- return true;
-}
-
-
-} // namespace support
-} // namespace lyx