macOS: make eina_environment_tmp_get() work as elsewhere.

On macOS the tmp file path always terminated with an additional
separator, causing issues when making file name comparisons.
For example, the Eio test suits would hang due to this.
This patch trims any trailing path. When joining paths
with eina_environment_tmp_get, macOS should behave
similarly as on other architectures.

Differential Revision: https://phab.enlightenment.org/D7128
This commit is contained in:
Alastair Poole 2018-10-02 11:24:58 +00:00 committed by Marcel Hollerbach
parent 66aa76ad89
commit 1566861ace
1 changed files with 11 additions and 0 deletions

View File

@ -118,6 +118,17 @@ eina_environment_tmp_get(void)
}
if (!tmp) tmp = "/tmp";
#endif
#if defined(__MACH__) && defined(__APPLE__)
if (tmp && tmp[strlen(tmp) -1] == '/')
{
char *tmp2 = strdup(tmp);
tmp2[strlen(tmp2) - 1] = 0x0;
tmp = tmp2;
return tmp;
}
#endif
tmp = strdup(tmp);
return tmp;
}