]> git.lyx.org Git - lyx.git/blob - src/support/chdir.C
Next step of true unicode filenames: Use support::FileName instead of
[lyx.git] / src / support / chdir.C
1 /**
2  * \file chdir.C
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
18 namespace lyx {
19
20 #ifdef HAVE_UNISTD_H
21 # include <unistd.h>
22 #endif
23
24 #ifdef _WIN32
25 # include <windows.h>
26 #endif
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