[GRASS-SVN] r52749 - grass/branches/develbranch_6/raster/r.terraflow

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 20 01:59:31 PDT 2012


Author: mmetz
Date: 2012-08-20 01:59:31 -0700 (Mon, 20 Aug 2012)
New Revision: 52749

Modified:
   grass/branches/develbranch_6/raster/r.terraflow/main.cc
Log:
r.terraflow fix for #520

Modified: grass/branches/develbranch_6/raster/r.terraflow/main.cc
===================================================================
--- grass/branches/develbranch_6/raster/r.terraflow/main.cc	2012-08-20 07:55:10 UTC (rev 52748)
+++ grass/branches/develbranch_6/raster/r.terraflow/main.cc	2012-08-20 08:59:31 UTC (rev 52749)
@@ -131,11 +131,6 @@
   streamdir->key        = "STREAM_DIR";
   streamdir->type       = TYPE_STRING;
   streamdir->required   = NO;
-#ifdef __MINGW32__
-  streamdir->answer     = G_convert_dirseps_from_host(G_store(getenv("TEMP")));
-#else
-  streamdir->answer     = G_store("/var/tmp/");
-#endif
   streamdir->description=
      _("Directory to hold temporary files (they can be large)");
 
@@ -179,7 +174,16 @@
   }
 
   opt->mem = atoi(mem->answer);
-  opt->streamdir = streamdir->answer;
+  if (!streamdir->answer) {
+    const char *tmpdir = G_tempfile();
+    
+    if (G_mkdir(tmpdir) == -1)
+	G_fatal_error(_("Unable to create temp dir"));
+    opt->streamdir = G_store(tmpdir);
+  }
+  else
+    opt->streamdir = streamdir->answer;
+
   opt->verbose = FALSE;
 
 /* please, remove before GRASS 7 released */



More information about the grass-commit mailing list