]> git.lyx.org Git - features.git/commitdiff
Implement os::current_root for native Win32 builds.
authorAngus Leeming <leeming@lyx.org>
Tue, 4 Jan 2005 17:50:25 +0000 (17:50 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 4 Jan 2005 17:50:25 +0000 (17:50 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9425 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/ChangeLog
src/support/os_win32.C

index b6dd5c5dd8424c2ba28936a7841c0533c93e5609..a36fc7f82b8dc5d06015a1db59c461e9d94644cc 100644 (file)
@@ -1,5 +1,7 @@
 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.
index 499dd6d26ed278d71a674af27a7b2091460aff8a..7de1274f9f8bbbda8f415902a509ce9b69165070 100644 (file)
 
 #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;
@@ -89,7 +95,14 @@ void warn(string const & mesg)
 
 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
 }