]> git.lyx.org Git - lyx.git/blobdiff - src/support/getcwd.C
hopefully fix tex2lyx linking.
[lyx.git] / src / support / getcwd.C
index 2514c15af14315e46e4e5c4d79e79b75dd044295..40b61a6a2609410f5e9e394ad683d5c580551182 100644 (file)
 #include <boost/scoped_array.hpp>
 
 #include <cerrno>
-#include <unistd.h>
+
+
+namespace lyx {
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef _WIN32
+# include <windows.h>
+#endif
 
 using boost::scoped_array;
 
@@ -27,10 +36,11 @@ namespace {
 inline
 char * l_getcwd(char * buffer, size_t size)
 {
-#ifndef __EMX__
-       return ::getcwd(buffer, size);
+#ifdef _WIN32
+       GetCurrentDirectory(size, buffer);
+       return buffer;
 #else
-       return ::_getcwd2(buffer, size);
+       return ::getcwd(buffer, size);
 #endif
 }
 
@@ -56,3 +66,6 @@ string const lyx::support::getcwd()
                result = tbuf.get();
        return result;
 }
+
+
+} // namespace lyx