Allow user specified VISITUSERHOME.
@@ -953,6 +953,9 @@ ReadKey(const char *key, char **keyval)
* Kathleen Biagas, Thu Nov 1 11:03:09 PDT 2012
* Set PYTHONHOME so cli still works if Python installed on system.
*
+ * Kathleen Biagas, Fri Jan 6 18:30:12 MST 2017
+ * Allow user to specify their own HOME via VISITUSERHOME env var.
+ *
*****************************************************************************/
std::string
@@ -1038,6 +1041,52 @@ GetVisItEnvironment(stringVector &env, bool useShortFileName, bool addPluginVars
/*
* Determine visit user path (Path to My Documents).
*/
+ {
+ // Test for user-specified VISITUSERHOME
+ string personalUserHome = WinGetEnv("VISITUSERHOME");
+ if (!personalUserHome.empty())
+ {
+ /* User specified path, check if writeable */
+ struct _stat fs;
+ if (_stat(personalUserHome.c_str(), &fs) == -1)
+ {
+ char tmp[1024];
+ SNPRINTF(tmp, 1024, "VISITUSERHOME is set in your environment"
+ " but the specified path does not exist.\n"
+ "(%s)\n"
+ "Please specify a valid path for VISITUSERHOME"
+ " before running VisIt again.\n",
+ personalUserHome.c_str());
+#ifdef VISIT_WINDOWS_APPLICATION
+ MessageBox(NULL, tmp, "", MB_OK);
+#else
+ fprintf(stderr, tmp);
+#endif
+ exit(0);
+ }
+ if (! (fs.st_mode & _S_IFDIR))
+ {
+ char tmp[1024];
+ SNPRINTF(tmp,1024, "VISITUSERHOME is set in your environment"
+ " but the specified value is not a folder:\n"
+ "(%s)\n"
+ "Please specify a valid folder path for "
+ "VISITUSERHOME before running VisIt again.\n",
+ personalUserHome.c_str());
+#ifdef VISIT_WINDOWS_APPLICATION
+ MessageBox(NULL, tmp, "", MB_OK);
+#else
+ fprintf(stderr, tmp);
+#endif
+ exit(0);
+ }
+ sprintf(tmpdir, "%s\\My images", personalUserHome.c_str());
+ if (_stat(tmpdir, &fs) == -1)
+ {
+ _mkdir(tmpdir);
+ }
+ }
+ else
{
char visituserpath[MAX_PATH], expvisituserpath[MAX_PATH];
bool haveVISITUSERHOME=0;
@@ -1070,6 +1119,7 @@ GetVisItEnvironment(stringVector &env, bool useShortFileName, bool addPluginVars
sprintf(tmp, "VISITUSERHOME=%s", expvisituserpath);
env.push_back(tmp);
}
+ }
/*
* Turn the long VisIt path into the shortened system path.
