mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Add Windows-specific code to userinfo.C.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9869 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8082ce80c7
commit
ab053d54bc
@ -568,39 +568,3 @@ diff -u -a -u -r1.25 tempname.C
|
||||
lyxerr[Debug::FILES] << "Temporary file `" << t
|
||||
<< "' created." << endl;
|
||||
return t;
|
||||
Index: src/support/userinfo.C
|
||||
===================================================================
|
||||
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/userinfo.C,v
|
||||
retrieving revision 1.10
|
||||
diff -u -a -u -r1.10 userinfo.C
|
||||
--- src/support/userinfo.C 15 Feb 2005 13:45:41 -0000 1.10
|
||||
+++ src/support/userinfo.C 19 Apr 2005 08:09:40 -0000
|
||||
@@ -15,7 +15,9 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
-#include <pwd.h>
|
||||
+#ifndef _WIN32
|
||||
+# include <pwd.h>
|
||||
+#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
@@ -28,6 +30,7 @@
|
||||
|
||||
string const user_name()
|
||||
{
|
||||
+#ifndef _WIN32
|
||||
struct passwd * pw(getpwuid(geteuid()));
|
||||
BOOST_ASSERT(pw);
|
||||
|
||||
@@ -35,6 +38,9 @@
|
||||
if (name.empty())
|
||||
name = pw->pw_name;
|
||||
return name;
|
||||
+#else
|
||||
+ return "dummy";
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2005-04-24 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* userinfo.C (user_name): add Windows-specific code.
|
||||
|
||||
2005-04-22 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* package.C.in (get_binary_path): on prompting from Rob Bearman,
|
||||
|
@ -15,8 +15,12 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <pwd.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#if defined (_WIN32)
|
||||
# include "gettext.h"
|
||||
# include <lmcons.h>
|
||||
# include <windows.h>
|
||||
#else
|
||||
# include <pwd.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
@ -28,6 +32,14 @@ namespace support {
|
||||
|
||||
string const user_name()
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
|
||||
char name[UNLEN + 1];
|
||||
DWORD size = UNLEN + 1;
|
||||
if (!GetUserName(name, &size))
|
||||
return _("Unknown user");
|
||||
return name;
|
||||
#else
|
||||
struct passwd * pw(getpwuid(geteuid()));
|
||||
BOOST_ASSERT(pw);
|
||||
|
||||
@ -35,6 +47,7 @@ string const user_name()
|
||||
if (name.empty())
|
||||
name = pw->pw_name;
|
||||
return name;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user