Jump to content
Server Maintenance This Week. ×

Temporary/cache files


This topic is 5801 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I use only Mac OSX.

My solution exports txt files for syncing data between different databases. Other routines export xsl files to format exports for import to a different application.

These processes create 'trash' txt and xsl and *ml files which never need to be seen by the user.

Where is the best place to create these files?

I have been using ~/Libray/Cache but the files are retained across logins & reboots. Looks like /tmp is the best bet.

What is best practice?

Thanks,

ft.

Link to comment
Share on other sites

I usually use AppleScript to find out the path to the user's temp folder.

path to temporary items as text

Which returns, for most people:

"Macintosh HD:private:var:tmp:folders.501:TemporaryItems:"

But if there's more than one user, it could be 502, 503, etc.. And the above method requires a global field to put the result into.

A level above that, which does not include the user "uid" would be:

"Macintosh HD:private:tmp:"

Which also requires the drive name. FileMaker syntax paths also require the drive name.

"filemac:/Macintosh HD/private/tmp/some file.txt"

Though you can get that via Get (SystemDrive). So you could use that to build the above path without using AppleScript.

I think using the user's temporary items folder is probably "best practice" however, from a "politically correct" point of view. But either path should work fine.

Link to comment
Share on other sites

Actually, I don't see why you'd really need to delete the xsl files. It seems as if they fall under the concept of "application support", which AppleScript can get:

path to application support

If you created a "FileMaker" folder in there, you'd be following the practices of many applications. You could then check to see if the file(s) were there, before exporting. More complex, but not much, and even more "politically correct."

Link to comment
Share on other sites

There is some controversy about that FileMaker 9 Temporary folder. FileMaker application uses it (8.5 also, maybe previous) for its temporary files, which it deletes when FileMaker quits. But otherwise files in that folder are NOT deleted when the computer restarts. I have some in there that are months old.

Since on a Mac I can easily build a path to a temporary folder where files are deleted on restart I don't use FileMaker's folder.

It does not even seem safe to delete all the files in the folder unless FileMaker is not running, unless you filter out the FileMaker app temp files.

Take a look, via AppleScript:

-- FileMaker Temporary Items folder

set p to alias "Macintosh HD:private:var:tmp:folders:501:TemporaryItems:FileMaker:"

tell application "Finder"

	open p

	activate

end tell

Link to comment
Share on other sites

Another angle for this:

Whenever I use 'temp' files for import/exporting etc in my solutions, I always clear or delete any information in the files when it is no longer needed.

Even if you don't delete them, there is less chance of any sensitive info leaking out.

Jerry

Link to comment
Share on other sites

This topic is 5801 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.