To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=64421
                  Issue #:|64421
                  Summary:|Mac OS X: create temp files in /tmp instead of
                          |/var/tmp
                Component:|porting
                  Version:|current
                 Platform:|All
                      URL:|
               OS/Version:|All
                   Status:|NEW
        Status whiteboard:|
                 Keywords:|
               Resolution:|
               Issue type:|DEFECT
                 Priority:|P4
             Subcomponent:|MacOSX
              Assigned to:|ericb
              Reported by:|pjanik





------- Additional comments from [EMAIL PROTECTED] Sat Apr 15 15:06:51 -0700 
2006 -------
Facts:
Current OOo creates *some* files in /var/tmp and some in /tmp.
/tmp is cleaned up on system boot. /var/tmp is not.
The variable P_tmpdir is defined in stdio.h as "/var/tmp".
Some parts of the code use different strategy to find the directory for
temporary files.

Apple suggests
(http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/Articles/WhereToPutFiles.html#//apple_ref/doc/uid/TP40001411-111010):

--- citation ---
Mac OS X provides an established set of directories for storing temporary files.
The primary directory (/tmp) is where most local files go, but you should never
hardcode this path into your application. Using hardcoded paths limits the
portability and longevity of your code. Instead, Carbon applications should use
the FSFindFolder function (in the Core Services framework) to obtain a reference
to the temporary directory; Cocoa applications should use the
NSTemporaryDirectory function in Foundation Kit.
--- citation ---

I experimented a bit with this function and here are the results:

# kUserDomain
macmini:~/q oo$ gcc -Wall tmpdir.c -framework CoreServices; ./a.out 
Temp directory is /Volumes/Build/oo/Library/Caches.
# kSystemDomain
macmini:~/q oo$ gcc -Wall tmpdir.c -framework CoreServices; ./a.out 
Temp directory is /private/var/tmp/folders.502/TemporaryItems.
macmini:~/q oo$ 

No /tmp ;-) Hmm. So: how "standard" we want to be? Do we want to put temporary
directories to system directory or user's temporary directory?

Source file for testing:

#include <stdio.h>
#include <CoreServices/CoreServices.h>

int main ()
{
  OSStatus status;
  FSRef tmpDirRef;
  UInt8 *path;

  status = FSFindFolder( kSystemDomain, kTemporaryFolderType,
                        kDontCreateFolder, &tmpDirRef);

  status = FSRefMakePath(&tmpDirRef,
                         path, PATH_MAX);

  printf("Temp directory is %s.\n", path);

  return 0;
}

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to