From cbd48ca7793494211abca14776d1a51cebac002e Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 4 Jan 2005 17:50:25 +0000 Subject: [PATCH] Implement os::current_root for native Win32 builds. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9425 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/ChangeLog | 2 ++ src/support/os_win32.C | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/support/ChangeLog b/src/support/ChangeLog index b6dd5c5dd8..a36fc7f82b 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,5 +1,7 @@ 2005-01-04 Angus Leeming + * 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. diff --git a/src/support/os_win32.C b/src/support/os_win32.C index 499dd6d26e..7de1274f9f 100644 --- a/src/support/os_win32.C +++ b/src/support/os_win32.C @@ -20,7 +20,13 @@ #include #include -#include + +#if defined(__CYGWIN__) || defined(__CYGWIN32__) +# include + +#elif defined(_WIN32) +# include // _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 } -- 2.39.5