문제

I'm writing a tool that needs to cache files that are supposed to be hidden from the uninformed user and persist across reboots. On Linux, I am putting these files in ~/.cache. What's the equivalent of that on the mac?

Can I just use ~/.cache? I also read about ~/Library/Application Support and ~/Library/Cache, but I'm finding a lot of contradictory information.

도움이 되었습니까?

해결책

The right place to store such files is "Library/Caches" (either in ~ or in the app sandbox, depending on whether or not your app is sandboxed).

Apple documents this fact here:

File System Basics

Especially take note of this quote:

Use this directory to write any app-specific support files that your app can re-create easily. Your app is generally responsible for managing the contents of this directory and for adding and deleting files as needed.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 apple.stackexchange
scroll top