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
This commit is contained in:
Angus Leeming 2005-01-04 17:50:25 +00:00
parent ea2982a143
commit cbd48ca779
2 changed files with 17 additions and 2 deletions

View 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.

View File

@ -20,7 +20,13 @@
#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
}