]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/utils.cpp
Applied patch #886192: "Minor fix to XRC contrib"; Minor cosmetic cleanups.
[wxWidgets.git] / src / os2 / utils.cpp
index 67e5fdad7841b10a2a14ad8d021340ffab6aa96b..df321ea4e3e61a1c0fdd58b890bf6c176c782477 100644 (file)
@@ -380,18 +380,24 @@ const wxChar* wxGetHomeDir(
     wxString&                       rStrDir = *pStr;
 
     // 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
 #ifndef MAX_PATH
 #  define MAX_PATH  256
 #endif
 
-    char                            zDirName[256];
-    ULONG                           ulDirLen;
+    const wxChar *szHome = wxGetenv("HOME");
+    if ( szHome == NULL ) {
+      // we're homeless, use current directory.
+      rStrDir = wxT(".");
+    }
+    else
+       rStrDir = szHome;
 
-    ::DosQueryCurrentDir(0, zDirName, &ulDirLen);
-    rStrDir = zDirName;
     return rStrDir.c_str();
 }