How to print specific user temp directory in macOS? It should be able to determine the temp dir depending on which user is currently logged in. I see that my current user temp dir is set to /Users/myuser/private/tmp but i have no generic way to get hold of this
Googled a bit and it recommeds using $TMPDIR but looks like my user temp dir is somewhat set to /Users/myuser/private/tmp
I should be able to determine the exact tmp directory whether the current user is root or other user
Related SO question and answer, cross-platform: Cross-platform way of getting temp directory in Python It's pretty generic.
In Qt5:
Also pretty generic.
In bash (terminal or script):
echo $TMPDIRThe
/var/folders/is user-specific because if you runls -l /var/folders/.../(right before the-Tmp-directory, you will see that the folder is owned by the logged in user. If another user is logged in, their folder is protected by their permissions/ownership and they won't be able to read/modify another users' data. I suggest looking into unix/linux/mac file and folder permissions if you want to know more.http://www.filepermissions.com/articles/what-are-file-permissions-in-linux-and-mac https://www.linux.com/tutorials/understanding-linux-file-permissions/