From c51deffc32ff80f4ed13a1095bbf2ff44de89505 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 9 Dec 1999 15:14:58 +0000 Subject: [PATCH] a more easy to use version of wxGetHomeDir() added git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4888 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/function.tex | 25 ++++++++++++++++++++----- include/wx/utils.h | 1 + src/common/utilscmn.cpp | 7 +++++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index 26367bbf94..da99a835ba 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -1284,11 +1284,15 @@ Under X only, returns the current display name. See also \helpref{wxSetDisplayNa -\membersection{::wxGetHomeDir} +\membersection{::wxGetHomeDir}\label{wxgethomedir} -\func{wxString}{wxGetHomeDir}{\param{const wxString\& }{buf}} +\func{wxString}{wxGetHomeDir}{\void} -Fills the buffer with a string representing the user's home directory (Unix only). +Return the (current) user's home directory. + +\wxheading{See also:} + +\helpref{wxGetUserHome}{wxgetuserhome} \wxheading{Include files} @@ -1300,8 +1304,7 @@ Fills the buffer with a string representing the user's home directory (Unix only Copies the host name of the machine the program is running on into the buffer {\it buf}, of maximum size {\it bufSize}, returning TRUE if -successful. Under Unix, this will return a machine name. Under Windows, -this returns ``windows''. +successful. \wxheading{Include files} @@ -1434,6 +1437,18 @@ Under Windows, this returns ``user''. +\membersection{::wxGetUserHome}\label{wxgetuserhome} + +\func{const wxChar *}{wxGetUserHome}{\param{const wxString\& }{user = ""}} + +Returns the home directory for the given user. If the username is empty +(default value), this function behaves like +\helpref{wxGetHomeDir}{wxgethomedir}. + +\wxheading{Include files} + + + \membersection{::wxGetUserName} \func{bool}{wxGetUserName}{\param{const wxString\& }{buf}, \param{int}{ bufSize}} diff --git a/include/wx/utils.h b/include/wx/utils.h index a3c326248b..7893bd1700 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -212,6 +212,7 @@ WXDLLEXPORT bool wxGetUserName(wxChar *buf, int maxSize); WXDLLEXPORT wxString wxGetUserName(); // Get current Home dir and copy to dest (returns pstr->c_str()) +WXDLLEXPORT wxString wxGetHomeDir(); WXDLLEXPORT const wxChar* wxGetHomeDir(wxString *pstr); // Get the user's home dir (caller must copy --- volatile) diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index bab380b7a8..9dd4d99b3e 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -1041,3 +1041,10 @@ wxString wxGetFullHostName() return buf; } +wxString wxGetHomeDir() +{ + wxString home; + wxGetHomeDir(&home); + + return home; +} -- 2.45.2