From b19c15f3fef6787cafe4e33d25451118dc189d23 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 21 May 2001 13:19:05 +0000
Subject: [PATCH] Pb with HOME on WinNT

---
 Common/Context.h   | 3 ++-
 Common/Options.cpp | 7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Common/Context.h b/Common/Context.h
index f8381d46c4..213669b516 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -39,7 +39,8 @@ public :
   char *display;              // forced display host:0.0 under X11 
   int  terminal;              // show we print to the terminal console?
   char *editor;               // text editor command (with included '%s')
-  char home_dir[NAME_STR_L];  // the home directory
+  char home_dir[NAME_STR_L], tmp_dir[NAME_STR_L];
+                              // the home and tmp directories
 
   int position[2];            // position of the menu window on the screen
   int gl_position[2];         // position of the graphic window on the screen
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 8ba0883001..2c04b8a413 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.20 2001-05-21 13:01:13 geuzaine Exp $
+// $Id: Options.cpp,v 1.21 2001-05-21 13:19:05 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -22,8 +22,11 @@ void Init_Options(int num){
   char *tmp;
 
   // Home directory
+#if !defined(WIN32) // Some WinNT systems have bad HOME variables...
   if((tmp = getenv("HOME")))      strcpy(CTX.home_dir, tmp);
-  else if((tmp = getenv("TMP")))  strcpy(CTX.home_dir, tmp);
+  else 
+#endif
+  if((tmp = getenv("TMP")))       strcpy(CTX.home_dir, tmp);
   else if((tmp = getenv("TEMP"))) strcpy(CTX.home_dir, tmp);
   else                            strcpy(CTX.home_dir, "");
   if(strlen(CTX.home_dir)){
-- 
GitLab