[GRASS-SVN] r60221 - grass/trunk/raster/r.li/r.li.daemon

svn_grass at osgeo.org svn_grass at osgeo.org
Tue May 13 03:06:21 PDT 2014


Author: martinl
Date: 2014-05-13 03:06:21 -0700 (Tue, 13 May 2014)
New Revision: 60221

Modified:
   grass/trunk/raster/r.li/r.li.daemon/daemon.c
Log:
r.li: use G_config_dir() - see r60220


Modified: grass/trunk/raster/r.li/r.li.daemon/daemon.c
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/daemon.c	2014-05-13 09:50:33 UTC (rev 60220)
+++ grass/trunk/raster/r.li/r.li.daemon/daemon.c	2014-05-13 10:06:21 UTC (rev 60221)
@@ -72,15 +72,13 @@
     /* strip off leading path if present */
     char testpath[GPATH_MAX];
 
-    sprintf(testpath, "%s%c.grass7%cr.li%c", G_home(), HOST_DIRSEP,
-	    HOST_DIRSEP, HOST_DIRSEP);
+    sprintf(testpath, "%s%c%s%c", G_config_path(), HOST_DIRSEP, "r.li", HOST_DIRSEP);
     if (strncmp(file, testpath, strlen(testpath)) == 0)
 	file += strlen(testpath);
 
     /* TODO: check if this path is portable */
     /* TODO: use G_rc_path() */
-    sprintf(pathSetup, "%s%c.grass7%cr.li%c%s", G_home(), HOST_DIRSEP,
-	    HOST_DIRSEP, HOST_DIRSEP, file);
+    sprintf(pathSetup, "%s%c%s%c%s", G_config_path(), HOST_DIRSEP, "r.li", HOST_DIRSEP, file);
     G_debug(1, "r.li.daemon pathSetup: [%s]", pathSetup);
     parsed = parseSetup(pathSetup, l, g, raster);
 
@@ -103,29 +101,24 @@
     else {
 	/* text file output */
 	/* check if ~/.grass7/ exists */
-	sprintf(out, "%s%c.grass7%c", G_home(), HOST_DIRSEP, HOST_DIRSEP);
+        sprintf(out, "%s", G_config_path());
 	doneDir = G_mkdir(out);
 	if (doneDir == -1 && errno != EEXIST)
-	    G_fatal_error(_("Cannot create %s%c.grass7%c directory"),
-			  G_home(), HOST_DIRSEP, HOST_DIRSEP);
+	    G_fatal_error(_("Cannot create %s directory"), out);
 
 	/* check if ~/.grass7/r.li/ exists */
-	sprintf(out, "%s%c.grass7%cr.li%c", G_home(), HOST_DIRSEP,
-		HOST_DIRSEP, HOST_DIRSEP);
+	sprintf(out, "%s%c%s%c", G_config_path(), HOST_DIRSEP, "r.li", HOST_DIRSEP);
 	doneDir = G_mkdir(out);
 	if (doneDir == -1 && errno != EEXIST)
-	    G_fatal_error(_("Cannot create %s%c.grass7%cr.li%c directory"),
-			  G_home(), HOST_DIRSEP, HOST_DIRSEP, HOST_DIRSEP);
+	    G_fatal_error(_("Cannot create %s directory"), out);
 
 	/* check if ~/.grass7/r.li/output exists */
-	sprintf(out, "%s%c.grass7%cr.li%coutput", G_home(), HOST_DIRSEP,
-		HOST_DIRSEP, HOST_DIRSEP);
+	sprintf(out, "%s%c%s%c%s", G_config_path(), HOST_DIRSEP, "r.li", HOST_DIRSEP, "output");
 	doneDir = G_mkdir(out);
 	if (doneDir == -1 && errno != EEXIST)
-	    G_fatal_error(_("Cannot create %s%c.grass7%cr.li%coutput%c directory"),
-			  G_home(), HOST_DIRSEP, HOST_DIRSEP, HOST_DIRSEP, HOST_DIRSEP);
-	sprintf(out, "%s%c.grass7%cr.li%coutput%c%s", G_home(), HOST_DIRSEP,
-		HOST_DIRSEP, HOST_DIRSEP, HOST_DIRSEP, output);
+	    G_fatal_error(_("Cannot create %s directory"), out);
+	sprintf(out, "%s%c%s%c%s%c%s",
+                G_config_path(), HOST_DIRSEP, "r.li", HOST_DIRSEP, "output", HOST_DIRSEP, output);
 	res = open(out, O_WRONLY | O_CREAT | O_TRUNC, 0644);
     }
     i = 0;



More information about the grass-commit mailing list