summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Bignier <paul.bignier@scilab-enterprises.com>2016-12-09 11:20:17 +0100
committerClement DAVID <clement.david@scilab-enterprises.com>2016-12-09 13:47:17 +0100
commit960ee79f60573d677d3820d43ec2074282bdc58f (patch)
treebf4058f535e5178eee0ba1146c9afe62b67558e4
parent10399acc59b9c8e5d9b791fdeae11dcc5300b164 (diff)
downloadscilab-960ee79f60573d677d3820d43ec2074282bdc58f.zip
scilab-960ee79f60573d677d3820d43ec2074282bdc58f.tar.gz
AST::System_env: fix MacOS launch after a3118bbf
* On MacOS, /tmp points to "private/tmp" instead of "/private/tmp" Change-Id: I9ac8987d001d0f7b9c0cd6a8d0d3fbef4ce2a30d
-rw-r--r--scilab/modules/ast/src/cpp/system_env/sci_tmpdir.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/scilab/modules/ast/src/cpp/system_env/sci_tmpdir.cpp b/scilab/modules/ast/src/cpp/system_env/sci_tmpdir.cpp
index 842fb2f..715493a 100644
--- a/scilab/modules/ast/src/cpp/system_env/sci_tmpdir.cpp
+++ b/scilab/modules/ast/src/cpp/system_env/sci_tmpdir.cpp
@@ -211,14 +211,24 @@ char* computeTMPDIR()
211 { 211 {
212 if (S_ISLNK(st.st_mode)) // Is it a symbolink link? 212 if (S_ISLNK(st.st_mode)) // Is it a symbolink link?
213 { 213 {
214 ssize_t end = readlink(tmp, env_dir, sizeof(char) * (PATH_MAX + 16)); 214 char env_dir2[PATH_MAX + 16];
215 ssize_t end = readlink(tmp, env_dir2, sizeof(char) * (PATH_MAX + 16)); // Use env_dir2 in case we need to add a '/' at the start
215 if (end == -1) 216 if (end == -1)
216 { 217 {
217 fprintf(stderr, _("Error: Could not resolve symbolic link %s\n"), tmp); 218 fprintf(stderr, _("Error: Could not resolve symbolic link %s\n"), tmp);
218 FREE(env_dir); 219 FREE(env_dir);
219 exit(1); 220 exit(1);
220 } 221 }
221 env_dir[end] = '\0'; 222 env_dir2[end] = '\0';
223 if (env_dir2[0] != '/') // No '/' found, add it at the beginning
224 {
225 env_dir[0] = '/';
226 strcpy(env_dir + 1, env_dir2);
227 }
228 else
229 {
230 strcpy(env_dir, env_dir2);
231 }
222 } 232 }
223 else // No, then hard code tmp 233 else // No, then hard code tmp
224 { 234 {