2005-01-04 Angus Leeming <leeming@lyx.org>
+ * os_win32.C (current_root): use _getdrive on Win32.
+
* FileInfo.C (FileInfo, newFile): strip the trailing '/' from
the stored file name as it breaks Window's version of stat().
(isLink): protect the code with #ifdef S_ISLNK.
#include <windows.h>
#include <io.h>
-#include <sys/cygwin.h>
+
+#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+# include <sys/cygwin.h>
+
+#elif defined(_WIN32)
+# include <direct.h> // _getdrive
+#endif
using namespace lyx::support;
using std::endl;
string current_root()
{
- return "/";
+#if defined(__CYGWIN__) || defined(__CYGWIN32__)
+ return string("/");
+
+#else
+ // _getdrive returns the current drive (1=A, 2=B, and so on).
+ char const drive = ::_getdrive() + 'A' - 1;
+ return string(1, drive) + ":/";
+#endif
}