Running Xojo 2021r3.1 in Big Sur 11.6.4, I create this folderItem:
dim f as FolderItem = SpecialFolder.Temporary.child(“pictureFromClipboard.png”)
From the docs, I expected a pathname like this: \Users\UserName\AppData\Local\Temp\
Instead, I’m getting this NativePath
Previously, I’d seen pathnames containing /private/tmp/ or /private/var/
Is /var/folders/ as the path for SpecialFolder.Temporary new? Or is it dependent on the OS version (I haven’t had a chance to try older versions of macOS).?
It changes from time to time, so it’s better to just use the SpecialFolder.Temporary method.
Thanks. I do use Temporary to save files. But I have methods in my app that let users display the contents of files, sometimes these are visible to the user and sometimes they are in the Temporary folder. I need to be able to tell if the file is in the Temporary folder so they can be moved to a user-accessible location like Documents. I guess I’ll have to add /var/folders/ to the list of paths that contain temporary folderItems.
That is the Windows location. For macOS is it in /var/folders/…
you can find the current location in macOS terminal:
# or use this to open the folder in Finder
On Windows, hit the start menu and type:
and hit enter
How… how do you give reddit gold on this forum?
I never knew about
I am so glad you shared this!
My super expert hacker way of figuring this out?
In macOS terminal, type
and you’ll see a list of environment variables.
Note: I believe that the Xojo Shell may not have the same environment as the Terminal app, so be don’t make any assumptions. I’m pretty sure there is, however, only one $TMPDIR (and I think it’s per-user but am not sure)
Thanks to everyone for this very helpful conversation.
Be warned, since 10.14, I have a handful of customers who’ve experienced the in-ability to access the temporary folder from within my applications. The solution I found (unless their temporary folder is full) is to use a different API via declares.
Unless you are performing atomic saving, I’d recommend creating a subfolder within your Application’s “Application Support” folder, or the cache folder (which is also specific to your application).