[英]Get Default Temporary Folder in Mac using Mono
I need my application to write buffer data to the temporary folder.When i used 我需要我的应用程序将缓冲区数据写入临时文件夹。
System.IO.Path.GetTempPath()
in Mac it returned a string 在Mac中,它返回了一个字符串
var/folders/r3/blah..blah/T/
(blah.blah = some random letters and digits) (blah.blah =一些随机的字母和数字)
Where exactly is this folder located? 该文件夹到底在哪里?
Doesn't Mac have a folder like Temp
in windows to place the temporary files? Mac在Windows中没有像Temp
这样的文件夹来放置临时文件吗?
Short answer : 简短答案:
For C#, Path.GetTempPath()
function returns value stored in environment variable $TMPDIR
. 对于C#, Path.GetTempPath()
函数返回存储在环境变量$TMPDIR
。 Value of $TMPDIR
in general is of following form : $TMPDIR
值通常具有以下形式:
/var/folders/{2 character random-string}/{random-string}/T
Long answer 长答案
Mac OS stores system-wide temporary files at : /var/folder/../T
Mac OS将系统范围的临时文件存储在:/ /var/folder/../T
This path can be found out using environment variable $TMPDIR
可以使用环境变量$TMPDIR
找到此路径
Please note that /tmp
or /var/tmp
are also temporary directory but its data is usually deleted upon rebooting Mac OS. 请注意, /tmp
或/var/tmp
也是临时目录,但是通常在重新启动Mac OS时会删除其数据。
Also, temporary directory depends upon what application you are using. 另外,临时目录取决于您使用的应用程序。
So, gist is there is no universal temp directory in mac os. 因此,要点是mac os中没有通用的临时目录。
Check out this links for more details : 查看此链接以获取更多详细信息:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.