]> git.lyx.org Git - lyx.git/blob - src/support/chdir.cpp
Fix bug 3904
[lyx.git] / src / support / chdir.cpp
1 /**
2  * \file chdir.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "support/lyxlib.h"
14
15 #include "support/FileName.h"
16
17 #ifdef HAVE_UNISTD_H
18 # include <unistd.h>
19 #endif
20
21 #ifdef _WIN32
22 # include <windows.h>
23 #endif
24
25
26 namespace lyx {
27
28 int support::chdir(FileName const & name)
29 {
30 #ifdef _WIN32
31         return SetCurrentDirectory(name.toFilesystemEncoding().c_str()) != 0 ? 0 : -1;
32 #else
33         return ::chdir(name.toFilesystemEncoding().c_str());
34 #endif
35 }
36
37
38 } // namespace lyx