For embedded projects, one may want to eliminate the per-session temp directory created by InitTempDir() and just use a system-specific temp directory. Here's my solution:
extern char *R_TempDir; void my_InitTempDir() { char *tmp; if (R_TempDir){ if (rmdir(R_TempDir) != 0){ perror("Fatal Error: could not remove R's TempDir!"); exit(1); } } tmp = getenv("TMPDIR"); if (tmp == NULL) { tmp = getenv("TMP"); if (tmp == NULL) { tmp = getenv("TEMP"); if (tmp == NULL) tmp = "/tmp"; } } R_TempDir=tmp; if (setenv("R_SESSION_TMPDIR",tmp,1) != 0){ perror("Fatal Error: couldn't set/replace R_SESSION_TMPDIR!"); exit(1); } } This function is called after Rf_initEmbeddedR; it's seems like a hack but it works. Does anyone have other solutions? Maybe InitTempDir could check if R_TempDir was not NULL and then just return. -- http://biostat.mc.vanderbilt.edu/JeffreyHorner ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel