|
@@ -102,8 +102,9 @@ int calculateIndex(char *file, int f(int, char **, area_des, double *),
|
|
|
######################################################### */
|
|
|
|
|
|
/* TODO: check if this path is portable */
|
|
|
- sprintf(pathSetup, "%s/.grass7/r.li/%s", getenv("HOME"), file);
|
|
|
- G_debug(1, "r.li.daemon pathSetup: %s", pathSetup);
|
|
|
+/* TODO: use G_rc_path() */
|
|
|
+ sprintf(pathSetup, "%s/.grass7/r.li/%s", G_home(), file);
|
|
|
+ G_debug(1, "r.li.daemon pathSetup: [%s]", pathSetup);
|
|
|
parsed = parseSetup(pathSetup, l, g, raster);
|
|
|
|
|
|
/*########################################################
|
|
@@ -124,20 +125,28 @@ int calculateIndex(char *file, int f(int, char **, area_des, double *),
|
|
|
G_fatal_error(_("Cannot create random access file"));
|
|
|
}
|
|
|
else {
|
|
|
- /*check if ~/.r.li/output exist */
|
|
|
- sprintf(out, "%s/.r.li/", getenv("HOME"));
|
|
|
+ /* check if ~/.grass7/ exists */
|
|
|
+ sprintf(out, "%s/.grass7/", G_home());
|
|
|
+ doneDir = G_mkdir(out);
|
|
|
+ if (doneDir == -1 && errno != EEXIST)
|
|
|
+ G_fatal_error(_("Cannot create %s/.grass7/ directory"),
|
|
|
+ G_home());
|
|
|
|
|
|
+ /* check if ~/.grass7/r.li/ exists */
|
|
|
+ sprintf(out, "%s/.grass7/r.li/", G_home());
|
|
|
doneDir = G_mkdir(out);
|
|
|
if (doneDir == -1 && errno != EEXIST)
|
|
|
- G_fatal_error(_("Cannot create %s/.r.li/ directory"),
|
|
|
- getenv("HOME"));
|
|
|
- sprintf(out, "%s/.r.li/output", getenv("HOME"));
|
|
|
+ G_fatal_error(_("Cannot create %s/.grass7/r.li/ directory"),
|
|
|
+ G_home());
|
|
|
+
|
|
|
+ /* check if ~/.grass7/r.li/output exists */
|
|
|
+ sprintf(out, "%s/.grass7/r.li/output", G_home());
|
|
|
doneDir = G_mkdir(out);
|
|
|
if (doneDir == -1 && errno != EEXIST)
|
|
|
- G_fatal_error(_("Cannot create %s/.r.li/output/ directory"),
|
|
|
- getenv("HOME"));
|
|
|
- sprintf(out, "%s/.r.li/output/%s", getenv("HOME"), output);
|
|
|
- res = open(out, O_WRONLY | O_CREAT | O_TRUNC, 0755);
|
|
|
+ G_fatal_error(_("Cannot create %s/.grass7/r.li/output/ directory"),
|
|
|
+ G_home());
|
|
|
+ sprintf(out, "%s/.grass7/r.li/output/%s", G_home(), output);
|
|
|
+ res = open(out, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
|
|
}
|
|
|
i = 0;
|
|
|
|