TMPDIR is a symbolic link to /private/tmp under MacOS
Vincent Couvert [Thu, 3 Sep 2009 12:11:58 +0000 (14:11 +0200)]
scilab/modules/core/src/c/tmpdir.c

index fcac9f1..d1529db 100644 (file)
@@ -108,8 +108,15 @@ void createScilabTMPDIR(void)
                static char bufenv[PATH_MAX + 16];
                first++;
 
+#ifdef __APPLE__
+                /* /tmp is a symbolic link to /private/tmp under MacOS */
+                realpath("/tmp/", tmp_dir);
+               sprintf(tmp_dir,"%s/SD_%d_",tmp_dir, (int) getpid());
+#else
                sprintf(tmp_dir,"/tmp/SD_%d_",(int) getpid());
+#endif
                createdirectory(tmp_dir) ;
+
                sprintf(bufenv,"TMPDIR=%s",tmp_dir);
                putenv(bufenv);
        }
@@ -137,4 +144,4 @@ void C2F(tmpdirc)(void)
 {
        removedir(tmp_dir);
 }
-/*--------------------------------------------------------------------------*/
\ No newline at end of file
+/*--------------------------------------------------------------------------*/