2003-06-18 09:56:10 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file chdir.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
2003-07-28 22:37:28 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2003-06-18 09:56:10 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-06-18 09:56:10 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2000-01-17 21:01:30 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "support/lyxlib.h"
|
|
|
|
|
|
2006-11-26 21:30:39 +00:00
|
|
|
|
#include "support/filename.h"
|
|
|
|
|
|
2005-01-20 15:38:14 +00:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
|
# include <unistd.h>
|
|
|
|
|
#endif
|
2004-11-07 13:22:51 +00:00
|
|
|
|
|
2005-01-31 15:26:40 +00:00
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
# include <windows.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-02-19 12:21:56 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2006-11-26 21:30:39 +00:00
|
|
|
|
int support::chdir(FileName const & name)
|
2000-09-26 13:54:57 +00:00
|
|
|
|
{
|
2006-05-14 17:00:53 +00:00
|
|
|
|
#ifdef _WIN32
|
2006-11-26 21:30:39 +00:00
|
|
|
|
return SetCurrentDirectory(name.toFilesystemEncoding().c_str()) != 0 ? 0 : -1;
|
2005-01-31 15:26:40 +00:00
|
|
|
|
#else
|
2006-11-26 21:30:39 +00:00
|
|
|
|
return ::chdir(name.toFilesystemEncoding().c_str());
|
2000-09-26 13:54:57 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|