Modified wxGetHomeDir to take environment variable HOME into account.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24580 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -380,18 +380,24 @@ const wxChar* wxGetHomeDir(
|
|||||||
wxString& rStrDir = *pStr;
|
wxString& rStrDir = *pStr;
|
||||||
|
|
||||||
// OS/2 has no idea about home,
|
// OS/2 has no idea about home,
|
||||||
// so use the working directory instead?
|
// so use the working directory instead.
|
||||||
|
// However, we might have a valid HOME directory,
|
||||||
|
// as is used on many machines that have unix utilities
|
||||||
|
// on them, so we should use that, if available.
|
||||||
|
|
||||||
// 256 was taken from os2def.h
|
// 256 was taken from os2def.h
|
||||||
#ifndef MAX_PATH
|
#ifndef MAX_PATH
|
||||||
# define MAX_PATH 256
|
# define MAX_PATH 256
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char zDirName[256];
|
const wxChar *szHome = wxGetenv("HOME");
|
||||||
ULONG ulDirLen;
|
if ( szHome == NULL ) {
|
||||||
|
// we're homeless, use current directory.
|
||||||
|
rStrDir = wxT(".");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rStrDir = szHome;
|
||||||
|
|
||||||
::DosQueryCurrentDir(0, zDirName, &ulDirLen);
|
|
||||||
rStrDir = zDirName;
|
|
||||||
return rStrDir.c_str();
|
return rStrDir.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user