[GRASS-SVN] r49785 - grass/trunk/raster/r.terraflow

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 16 06:30:10 EST 2011


Author: mmetz
Date: 2011-12-16 03:30:10 -0800 (Fri, 16 Dec 2011)
New Revision: 49785

Modified:
   grass/trunk/raster/r.terraflow/main.cpp
Log:
r.terraflow: use GRASS .tmp dir for temp data

Modified: grass/trunk/raster/r.terraflow/main.cpp
===================================================================
--- grass/trunk/raster/r.terraflow/main.cpp	2011-12-16 11:12:18 UTC (rev 49784)
+++ grass/trunk/raster/r.terraflow/main.cpp	2011-12-16 11:30:10 UTC (rev 49785)
@@ -131,11 +131,7 @@
   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->answer     = "";
   streamdir->description=
      _("Directory to hold temporary files (they can be large)");
 
@@ -172,7 +168,15 @@
   }
 
   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 = G_verbose() == G_verbose_max();
 



More information about the grass-commit mailing list