}
+bool FileName::chdir() const
+{
+ return QDir::setCurrent(d->fi.absoluteFilePath());
+}
+
+
extern unsigned long sum(char const * file);
unsigned long FileName::checksum() const
/// used for display in the Gui
docstring displayName(int threshold = 1000) const;
+ /// change to a directory, return success
+ bool chdir() const;
+
//private:
friend class DocFileName;
///
FileMonitor.cpp \
RandomAccessList.h \
abort.cpp \
- chdir.cpp \
convert.cpp \
convert.h \
copy.cpp \
if (!path.empty()) {
pushedDir_ = getcwd();
- if (pushedDir_.empty() || chdir(path)) {
+ if (pushedDir_.empty() || !path.chdir()) {
/* FIXME: throw */
}
} else {
return 0;
}
- if (chdir(pushedDir_)) {
+ if (!pushedDir_.chdir()) {
// should throw an exception
// throw DirChangeError();
}
+++ /dev/null
-/**
- * \file chdir.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"
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#ifdef _WIN32
-# include <windows.h>
-#endif
-
-
-namespace lyx {
-
-int support::chdir(FileName const & name)
-{
-#ifdef _WIN32
- return SetCurrentDirectory(name.toFilesystemEncoding().c_str()) != 0 ? 0 : -1;
-#else
- return ::chdir(name.toFilesystemEncoding().c_str());
-#endif
-}
-
-
-} // namespace lyx
/// get the current working directory
FileName const getcwd();
-/// change to a directory, 0 is returned on success.
-int chdir(FileName const & name);
/// Change file permissions
bool chmod(FileName const & file, unsigned long int mode);
/**
#include <config.h>
#include "support/lyxlib.h"
+#include "support/debug.h"
#include "support/FileName.h"
#ifdef HAVE_SYS_STAT_H
int mymkdir(char const * pathname, unsigned long int mode)
{
+ LYXERR0("MKDIR" << pathname);
// FIXME: why don't we have mode_t in lyx::mkdir prototype ??
#if HAVE_MKDIR
# if MKDIR_TAKES_ONE_ARG